1. Augie Fackler
  2. hgsubversion
Issue #421 wontfix

fail to clone a repository with mercurial 3.0-rc

JaviMerino
created an issue

With mercurial 3.0-rc and latest hgsbuversion (a22d4972e01f), if you try to clone an svn repository you get:

$ hg clone svn://127.0.0.1/celesteville
destination directory: celesteville
** Unknown exception encountered with possibly-broken third-party extension hgsubversion
** which supports versions unknown of Mercurial.
** Please disable hgsubversion and try your action again.
** If that fixes the bug please report it to the extension author.
** Python 2.7.6 (default, Mar 22 2014, 15:40:47) [GCC 4.8.2]
** Mercurial Distributed SCM (version 3.0-rc)
** Extensions loaded: hgsubversion
Traceback (most recent call last):
  File "/usr/bin/hg", line 38, in <module>
    mercurial.dispatch.run()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 28, in run
    sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 69, in dispatch
    ret = _runcatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 138, in _runcatch
    return _dispatch(req)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 810, in _dispatch
    cmdpats, cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 590, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 901, in _runcommand
    return checkargs()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 872, in checkargs
    return cmdfunc()
  File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 807, in <lambda>
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 151, in wrap
    util.checksignature(origfn), *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/root/hgsubversion/hgsubversion/wrappers.py", line 603, in clone
    orig(ui, source, dest, **opts)
  File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 518, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 1298, in clone
    branch=opts.get('branch'))
  File "/usr/lib/python2.7/dist-packages/mercurial/extensions.py", line 196, in wrap
    return wrapper(origfn, *args, **kwargs)
  File "/root/hgsubversion/hgsubversion/wrappers.py", line 592, in hgclonewrapper
    data['srcrepo'], data['dstrepo'] = orig(ui, *args, **opts)
  File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 400, in clone
    destpeer.local().clone(srcpeer, heads=revs, stream=stream)
  File "/usr/lib/python2.7/dist-packages/mercurial/localrepo.py", line 1860, in clone
    return self.pull(remote, heads)
  File "/root/hgsubversion/hgsubversion/svnrepo.py", line 77, in wrapper
    return fn(self, *args, **opts)
  File "/root/hgsubversion/hgsubversion/svnrepo.py", line 105, in pull
    return wrappers.pull(self, remote, heads, force)
  File "/root/hgsubversion/hgsubversion/wrappers.py", line 434, in pull
    tbdelta = meta.update_branch_tag_map_for_rev(r)
  File "/root/hgsubversion/hgsubversion/svnmeta.py", line 456, in update_branch_tag_map_for_rev
    t_name = self.get_path_tag(p)
  File "/root/hgsubversion/hgsubversion/svnmeta.py", line 274, in get_path_tag
    return self.layoutobj.get_path_tag(path, self.taglocations)
  File "/root/hgsubversion/hgsubversion/svnmeta.py", line 264, in taglocations
    return self.layoutobj.taglocations(self.metapath)
  File "/root/hgsubversion/hgsubversion/layouts/standard.py", line 69, in taglocations
    self._tag_locations = util.load(tag_locations_file)
  File "/usr/lib/python2.7/dist-packages/mercurial/demandimport.py", line 103, in __getattribute__
    return getattr(self._module, attr)
AttributeError: 'module' object has no attribute 'load'
$ hg version --svn
Mercurial Distributed SCM (version 3.0-rc)
(see http://mercurial.selenic.com for more information)

Copyright (C) 2005-2014 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

hgsubversion: a22d4972e01f
Subversion: 1.8.8
bindings: Subvertpy 0.9.1

This also happens with hgsubversion 1.6

Comments (20)

  1. Augie Fackler repo owner

    I can't reproduce this. Also:

    augie% cat hgsubversion/util.py | grep 'def load'
    def load(file_path, default=None, resave=True):
    

    Can you try cloning some public repo and see if that works for you? Maybe http://skia.googlecode.com/svn or something.

  2. Augie Fackler repo owner

    It strikes me as very likely you have a stale pyc file somewhere for the hgsubversion.util module - or else that file isn't as it is in head. Can you try a completely pristine checkout somewhere and report back? Maybe on another machine just to be sure?

    (I still can't reproduce this, and it's very likely that I'll do a release in a few hours to support hg 3.0.)

  3. fschoenm

    I have the same problem on Windows:

    % hg pull -u
    pulling from xxx
    ** Unknown exception encountered with possibly-broken third-party extension hgsubversion
    ** which supports versions unknown of Mercurial.
    ** Please disable hgsubversion and try your action again.
    ** If that fixes the bug please report it to the extension author.
    ** Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)]
    ** Mercurial Distributed SCM (version 3.0.1)
    ** Extensions loaded: color, convert, extdiff, graphlog, hgsubversion, strip, mq, progress, purge, record, rebase, shelve, zeroconf
    Traceback (most recent call last):
      File "hg", line 42, in <module>
      File "mercurial\dispatch.pyo", line 28, in run
      File "mercurial\dispatch.pyo", line 69, in dispatch
      File "mercurial\dispatch.pyo", line 138, in _runcatch
      File "mercurial\dispatch.pyo", line 819, in _dispatch
      File "mercurial\dispatch.pyo", line 599, in runcommand
      File "mercurial\extensions.pyo", line 196, in wrap
      File "hgext\color.pyo", line 431, in colorcmd
      File "mercurial\extensions.pyo", line 196, in wrap
      File "hgext\zeroconf\__init__.pyo", line 175, in cleanupafterdispatch
      File "mercurial\dispatch.pyo", line 910, in _runcommand
      File "mercurial\dispatch.pyo", line 881, in checkargs
      File "mercurial\dispatch.pyo", line 816, in <lambda>
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\extensions.pyo", line 151, in wrap
      File "mercurial\util.pyo", line 518, in check
      File "hgext\mq.pyo", line 3387, in mqcommand
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\extensions.pyo", line 151, in wrap
      File "mercurial\util.pyo", line 518, in check
      File "C:/Users/xxx/hgsubversion\hgsubversion\wrappers.py", line 645, in generic
        return orig(ui, repo, *args, **opts)
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\extensions.pyo", line 151, in wrap
      File "mercurial\util.pyo", line 518, in check
      File "hgext\rebase.pyo", line 933, in pullrebase
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\commands.pyo", line 4607, in pull
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnrepo.py", line 77, in wrapper
        return fn(self, *args, **opts)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnrepo.py", line 105, in pull
        return wrappers.pull(self, remote, heads, force)
      File "C:/Users/xxx/hgsubversion\hgsubversion\wrappers.py", line 434, in pull
        tbdelta = meta.update_branch_tag_map_for_rev(r)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnmeta.py", line 532, in update_branch_tag_map_for_rev
        t_name = self.get_path_tag(p)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnmeta.py", line 350, in get_path_tag
        return self.layoutobj.get_path_tag(path, self.taglocations)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnmeta.py", line 340, in taglocations
        return self.layoutobj.taglocations(self.metapath)
      File "C:/Users/xxx/hgsubversion\hgsubversion\layouts\standard.py", line 69, in taglocations
        self._tag_locations = util.load(tag_locations_file)
      File "mercurial\demandimport.pyo", line 103, in __getattribute__
    AttributeError: 'module' object has no attribute 'load'
    

    I have hg 3.0.1 and the latest hgsubversion version. I also did a pristine checkout, which didn't help.

    % hg sum
    parent: 1196:878372849175 tip
     maps: use meta.caseignoreauthors intead of accessing ui directly
    branch: default
    commit: (clean)
    update: (current)
    

    I am also not sure what triggered this behavior. Everything worked fine on Friday. I updated from hg 3.0 to 3.0.1 on Friday but unfortunately I can't remember if I did my last successful SVN pull before or after that.

  4. fschoenm

    I added to the load() function in util.py some output:

    def load(file_path, default=None, resave=True):
        """Deserialize some data from a path.
        """
        print("util.load(" + file_path + ")")   # <--- OUTPUT
        data = default
        if not os.path.exists(file_path):
            return data
    
        f = open(file_path)
        try:
            data = _convert(json.load(f), _descrub)
            f.close()
        except ValueError:
            try:
                # Ok, JSON couldn't be loaded, so we'll try the old way of using pickle
                data = compathacks.pickle_load(f)
            except:
                # well, pickle didn't work either, so we reset the file pointer and
                # read the string
                f.seek(0)
                data = f.read()
    
            # convert the file to json immediately
            f.close()
            if resave:
                dump(data, file_path)
        return data
    

    Now when calling "hg incoming" I get the following output:

    % hg inc
    util.load(C:\devel\xxx\.hg\svn\uuid)
    util.load(C:\devel\xxx\.hg\svn\subdir)
    util.load(C:\devel\xxx\.hg\svn\branch_info)
    util.load(C:\devel\xxx\.hg\svn\defaulthost)
    incoming changes from xxx
    util.load(C:\devel\xxx\.hg\svn\lastpulled)
    
    revision:    19082
    user:        xxx
    date:        2014-06-06T14:04:34.166181Z
    message:     xxx
    
    revision:    19083
    user:        xxx
    date:        2014-06-06T14:05:00.896678Z
    message:     xxx
    

    But calling "hg pull" still leads to this error:

    % hg pull
    pulling from xxx
    util.load(C:\devel\xxx\.hg\svn\uuid)
    util.load(C:\devel\xxx\.hg\svn\subdir)
    util.load(C:\devel\xxx\.hg\svn\branch_info)
    util.load(C:\devel\xxx\.hg\svn\defaulthost)
    util.load(C:\devel\xxx\.hg\svn\lastpulled)
    taglocations()
    ** Unknown exception encountered with possibly-broken third-party extension hgsubversion
    ** which supports versions unknown of Mercurial.
    ** Please disable hgsubversion and try your action again.
    ** If that fixes the bug please report it to the extension author.
    ** Python 2.7.6 (default, Nov 10 2013, 19:24:24) [MSC v.1500 64 bit (AMD64)]
    ** Mercurial Distributed SCM (version 3.0.1)
    ** Extensions loaded: color, convert, extdiff, graphlog, hgsubversion, strip, mq, progress, purge, record, rebase, shelve, zeroconf
    Traceback (most recent call last):
      File "hg", line 42, in <module>
      File "mercurial\dispatch.pyo", line 28, in run
      File "mercurial\dispatch.pyo", line 69, in dispatch
      File "mercurial\dispatch.pyo", line 138, in _runcatch
      File "mercurial\dispatch.pyo", line 819, in _dispatch
      File "mercurial\dispatch.pyo", line 599, in runcommand
      File "mercurial\extensions.pyo", line 196, in wrap
      File "hgext\color.pyo", line 431, in colorcmd
      File "mercurial\extensions.pyo", line 196, in wrap
      File "hgext\zeroconf\__init__.pyo", line 175, in cleanupafterdispatch
      File "mercurial\dispatch.pyo", line 910, in _runcommand
      File "mercurial\dispatch.pyo", line 881, in checkargs
      File "mercurial\dispatch.pyo", line 816, in <lambda>
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\extensions.pyo", line 151, in wrap
      File "mercurial\util.pyo", line 518, in check
      File "hgext\mq.pyo", line 3387, in mqcommand
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\extensions.pyo", line 151, in wrap
      File "mercurial\util.pyo", line 518, in check
      File "C:/Users/fschoenm/hgsubversion\hgsubversion\wrappers.py", line 645, in generic
        return orig(ui, repo, *args, **opts)
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\extensions.pyo", line 151, in wrap
      File "mercurial\util.pyo", line 518, in check
      File "hgext\rebase.pyo", line 933, in pullrebase
      File "mercurial\util.pyo", line 518, in check
      File "mercurial\commands.pyo", line 4607, in pull
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnrepo.py", line 77, in wrapper
        return fn(self, *args, **opts)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnrepo.py", line 105, in pull
        return wrappers.pull(self, remote, heads, force)
      File "C:/Users/xxx/hgsubversion\hgsubversion\wrappers.py", line 434, in pull
        tbdelta = meta.update_branch_tag_map_for_rev(r)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnmeta.py", line 532, in update_branch_tag_map_for_rev
        t_name = self.get_path_tag(p)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnmeta.py", line 350, in get_path_tag
        return self.layoutobj.get_path_tag(path, self.taglocations)
      File "C:/Users/xxx/hgsubversion\hgsubversion\svnmeta.py", line 340, in taglocations
        return self.layoutobj.taglocations(self.metapath)
      File "C:/Users/xxx/hgsubversion\hgsubversion\layouts\standard.py", line 71, in taglocations
        self._tag_locations = util.load(tag_locations_file)
      File "mercurial\demandimport.pyo", line 103, in __getattribute__
    AttributeError: 'module' object has no attribute 'load'
    
  5. fschoenm

    Some more info: I copied the file util.py to util2.py and changed the taglocations() function to use the new file. This prevents the above exception. I still have no idea what is causing this.

    After this change, hgsubversion does a "replay: fetching full revision" when pulling. It's still running so I don't know yet if it's going to pass.

  6. robi_wan

    I had the same error - I had to edit hgsubversion/layouts/standard.py:

    --- hgsubversion/layouts/standard.py    (revision 1196:87837284917582689a552de2a7bc4dede3dbfe75)
    +++ hgsubversion/layouts/standard.py    (revision 1196+:878372849175+)
    @@ -59,7 +59,7 @@
             try:
                 # newer versions of mercurial >= 2.8 will import this because the
                 # hgext_ logic is already being done in core
    -            from hgsubversion import util
    +            from hgext_hgsubversion import util
             except ImportError:
                 from hgext_hgsubversion import util
    

    Maybe the version of hgsubversion delivered with TortoiseHg differs from tip of hgsubversion.

    I use TortoiseHg 3.0.1 with Mercurial-3.0.1, Python-2.7.6, PyQt-4.10.3, Qt-4.8.5. The error did not occur in TortoiseHg 3.0 with Mercurial-3.0+3 ...

  7. Zane Purvis

    I'm using hgsubversion f367a4462191 (current tip) with TortoiseHG 3.1.1 (which include Mercurial-3.1.1 and Python-2.7.6) on Windows 7.

    I get this crash when I try to clone using standard layout (doesn't happen with single). Even the example hg clone http://python-nose.googlecode.com/svn nose-hg has the problem.

    When I modify hgsubversion/layouts/standard.py and ensure that StandardLayout.taglocations() uses util from hgext_hgsubversion, my clone works fine even with standard. (Like robi_wan)

    Looking at a failing version of the code, util.__file__ is c:\Program Files\TortoiseHg\library.zip\hgsubversion\util.pyo rather than the one in my own clone of hgsubversion.

    dir(util) returns:

    ['PrefixMatch', '__builtins__', '__class__', '__delattr__', '__dict__', '__doc__', '__file__', '__format__', '__getattribute__', '__hash__', '__init__', '__loader__', '__name__', '__new__', '__package__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_templatehelper', 'a_re', 'b_re', 'cmdutil', 'configpath', 'deque', 'describe_commit', 'devnull_re', 'errno', 'error', 'filterdiff', 'formatrev', 'getfilestoresize', 'getmessage', 'getsvnrev', 'header_re', 'hg', 'hgutil', 'ignoredfiles', 'isancestor', 'islocalrepo', 'issamefile', 'load_string', 'maps', 'newfile_devnull_re', 'node', 'normalize_url', 'os', 'outgoing_common_and_heads', 'outgoing_revisions', 'parentrev', 'parse_revnum', 'parseurl', 'pickle', 'pickle_atomic', 're', 'repair', 'revset', 'revset_fromsvn', 'revset_stringset', 'revset_svnrev', 'revsets', 'save_string', 'strip', 'svnpathkw', 'svnrevkw', 'svnuuidkw', 'swap_out_encoding', 'templatekeywords', 'urllib', 'version']
    

    So, it looks like, on Windows with TortoiseHG, the wrong util is being found.

  8. Mark Hadfield

    Having already encountered this problem on 16 July, I ran into it again today, now with Windows 7, Tortoisehg 3.1.2, Mercurial 3.1.2. On both occasions, I fixed it by applyin robi wan's fix. (I am not 100% sure why I had to apply the same fix twice, but I think I discarded the changeset associated with the first fix some time between July and now.)

  9. Johan Riisberg-Jensen

    Is changing hgsubversion/layouts/standard.py enough or was there more to Robi Wan's fix? Also the lines in Robi Wan's fix are not in the same as in mine. The same line for me is in row 70.

    I can't get this to work...Any ideas?

  10. Augie Fackler repo owner

    Robi Wan's solution is, at best, masking something horrible going on in your setup.

    How is hgsubversion installed? What does 'python -c "from hgsubversion import util; print util.file"' do for you?

    It's very likely you need to talk to tortoise folks about this to get some expertise around how tortoise is packaged and windows. I know nothing about either.

  11. Augie Fackler repo owner

    As far as I can tell, this is either:

    1) stale pyc files 2) something odd about how tortoise on windows is packaged

    either way, I'm not able to fix this without a meaningful diagnosis from someone on Windows (renaming util.py is NOT a fix - you're treating a symptom, not finding the disease.)

  12. Augie Fackler repo owner

    You only answered one of my questions.

    At this point, please either:

    1) contact the hgsubversion google group or 2) contact the tortoisehg devs

    It's very likely that 2 will be more fruitful, as I'm completely unfamiliar with both tortoise and windows.

  13. Johan Riisberg-Jensen

    $> hg version --svn Mercurial Distribuerad SCM (version 3.0.1) (se http://mercurial.selenic.com för mer information)

    Copyright (C) 2005-2014 Matt Mackall and others This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    hgsubversion: cc1e2c8cdaa6 Subversion: 1.7.5 bindings: Subvertpy 0.9.1

    Is that OK?

  14. Augie Fackler repo owner

    At this point, please either:

    1) contact the hgsubversion google group

    or

    2) contact the tortoisehg devs

    It's very likely that 2 will be more fruitful, as I'm completely unfamiliar with both tortoise and windows.

    (and you still didn't answer my question about how hgsubversion is installed. If you don't understand the question, clarify it, don't guess what I meant. But I'm not responding on this issue anymore, as it's significantly more work for me than just dealing with email, and I'm almost certainly unable to help you because of Windows anyway.)

  15. Log in to comment