schacon / hg-git

mercurial to git bridge, pushed to directly from the hg-git plugin in Hg
GNU General Public License v2.0
620 stars 71 forks source link

gclone fails with python 2.4 and mercurial 1.2.1 #5

Closed johnsonm closed 15 years ago

johnsonm commented 15 years ago

I don't know how to make this look readable in GitHub Flavored Markdown, but (with my hack/workaround for python 2.4 in issue #4) I get the following:

$ hg gclone git://github.com/schacon/hg-git
fetching from : origin
exporting git objects
Counting objects: 469, done.
Compressing objects: 100% (438/438), done.
Total 469 (delta 158), reused 311 (delta 0)
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 1.2.1)
** Extensions loaded: hg-git, hgk, mq, purge, record, transplant
Traceback (most recent call last):
  File "/usr/bin/hg", line 27, in ?
    mercurial.dispatch.run()
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 16, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 25, in dispatch
    return _runcatch(u, args)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 41, in _runcatch
    return _dispatch(ui, args)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 372, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 247, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 417, in _runcommand
    return checkargs()
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 377, in checkargs
    return cmdfunc()
  File "/usr/lib/python2.4/site-packages/mercurial/dispatch.py", line 371, in 
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/python2.4/site-packages/mercurial/util.py", line 718, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/__init__.py", line 45, in gclone
    git.fetch('origin')
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/git_handler.py", line 118, in fetch
    refs = self.fetch_pack(remote_name)
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/git_handler.py", line 404, in fetch_pack
    commit()
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/dulwich/object_store.py", line 213, in commit
    self.move_in_pack(path)
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/dulwich/object_store.py", line 178, in move_in_pack
    p = PackData(path)
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/dulwich/pack.py", line 434, in __init__
    self._read_header()
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/dulwich/pack.py", line 442, in _read_header
    (version, self._num_objects) = read_pack_header(self._file)
  File "/usr/lib/python2.4/site-packages/hgext/hg-git/dulwich/pack.py", line 345, in read_pack_header
    (version,) = unpack_from(">L", header, 4)
  File "/usr/lib/python2.4/site-packages/mercurial/demandimport.py", line 71, in __call__
    raise TypeError("%s object is not callable" % repr(self))
TypeError:  object is not callable
undees commented 15 years ago

I see a similar error with Mercurial 1.2 and 1.2.1, stock Leopard PPC Python 2.5, and all extensions disabled (except the two for this usage, of course):

$ hg gclone git://github.com/chneukirchen/bacon.git
fetching from : origin
exporting git objects
Counting objects: 352, done.
Compressing objects: 100% (179/179), done.
Total 352 (delta 147), reused 274 (delta 111)
importing Git objects into Hg
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial@selenic.com
** Mercurial Distributed SCM (version 1.2.1)
** Extensions loaded: bookmarks, hg-git
Traceback (most recent call last):
  File "/usr/local/bin/hg", line 27, in 
    mercurial.dispatch.run()
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 16, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 25, in dispatch
    return _runcatch(u, args)
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 41, in _runcatch
    return _dispatch(ui, args)
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 372, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 247, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 417, in _runcommand
    return checkargs()
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 377, in checkargs
    return cmdfunc()
  File "/Library/Python/2.5/site-packages/mercurial/dispatch.py", line 371, in 
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/Library/Python/2.5/site-packages/mercurial/util.py", line 718, in check
    return func(*args, **kwargs)
  File "/Users/me/src/ext/hg-git/__init__.py", line 45, in gclone
    git.fetch('origin')
  File "/Users/me/src/ext/hg-git/git_handler.py", line 120, in fetch
    self.import_git_objects(remote_name)
  File "/Users/me/src/ext/hg-git/git_handler.py", line 447, in import_git_objects
    commits = TopoSort(convert_list).items()
  File "/Users/me/src/ext/hg-git/git_handler.py", line 602, in __init__
    self._sorted = self.robust_topological_sort(commitdict)
  File "/Users/me/src/ext/hg-git/git_handler.py", line 698, in robust_topological_sort
    components = self.strongly_connected_components(graph)
  File "/Users/me/src/ext/hg-git/git_handler.py", line 644, in strongly_connected_components
    for w in v_nbrs:
TypeError: 'Commit' object is not iterable
undees commented 15 years ago

When I revert the strongly_connected_components function to the recursive version, this error goes away.

pjhyett commented 15 years ago

Also receiving this error on hg 1.2.1 and stock python 2.5 on leopard with the example munger gclone

johnsonm commented 15 years ago

stepancheg addressed this in issue #4 with the patch http://bitbucket.org/stepancheg/hg-git-patches/src/tip/demandimport

schacon commented 15 years ago

i have applied stepanchegs changes, so this should be fixed, but I haven't tested it on the systems you mention yet.

johnsonm commented 15 years ago

Confirmed fixed.