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

Can not clone hg-git: TypeError: b2a_hex() argument 1 must be string or read-only buffer, not None #120

Closed brainsik closed 10 years ago

brainsik commented 13 years ago

Trying all these different versions:

Hg: 1.5.4, 1.6 Dulwich: 0.6.0, git master Hg-Git: 0.2.2, git master

I get the same, following error:

$ hg clone git://github.com/schacon/hg-git.git

destination directory: hg-git importing Hg objects into Git Counting objects: 1726, done. Compressing objects: 100% (1683/1683), done. Total 1726 (delta 501), reused 1214 (delta 7) importing Git objects into Hg * unknown exception encountered, details follow
* report bug details to http://mercurial.selenic.com/bts/
* or mercurial@selenic.com
* Python 2.6.5 (r265:79063, Jun 14 2010, 09:23:41) [GCC 4.2.1 (Apple Inc. build 5659)]
* Mercurial Distributed SCM (version 1.5.4)
* Extensions loaded: bookmarks, color, extdiff, fetch, graphlog, pager, progress, purge, rebase, hggit Traceback (most recent call last): File "/Users/brainsik/src/venv/hggit/bin/hg", line 27, in mercurial.dispatch.run() File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 16, in run sys.exit(dispatch(sys.argv[1:])) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 30, in dispatch return _runcatch(u, args) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 50, in _runcatch return _dispatch(ui, args) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 471, in _dispatch return runcommand(lui, repo, cmd, fullargs, ui, options, d) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 341, in runcommand ret = _runcommand(ui, options, cmd, d) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/extensions.py", line 128, in wrap return wrapper(origfn, _args, _kwargs) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/hgext/pager.py", line 91, in pagecmd return orig(ui, options, cmd, cmdfunc) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 522, in _runcommand return checkargs() File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 476, in checkargs return cmdfunc() File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/dispatch.py", line 470, in d = lambda: util.checksignature(func)(ui, _args, _cmdoptions) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/util.py", line 401, in check return func(_args, *_kwargs) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/commands.py", line 681, in clone branch=opts.get('branch')) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/hg.py", line 316, in clone dest_repo.clone(src_repo, heads=revs, stream=stream) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/localrepo.py", line 2212, in clone return self.pull(remote, heads) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/hggit/hgrepo.py", line 12, in pull git.fetch(remote.path, heads) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/hggit/git_handler.py", line 100, in fetch self.import_git_objects(remote_name, refs) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/hggit/git_handler.py", line 407, in import_git_objects self.import_git_commit(commit) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/hggit/git_handler.py", line 527, in import_git_commit node = self.repo.commitctx(ctx) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/hgext/bookmarks.py", line 268, in commitctx node = super(bookmark_repo, self).commitctx(ctx, error) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/localrepo.py", line 905, in commitctx changed) File "/Users/brainsik/src/venv/hggit/lib/python2.6/site-packages/mercurial/localrepo.py", line 734, in _filecommit self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev))) TypeError: b2a_hex() argument 1 must be string or read-only buffer, not None

jimcook commented 13 years ago

I get the same error. I have:

Python version 2.6.5 Mercurial version 1.6.2 Dulwich 0.6.1 hg-git 0.2.4

saturnjct commented 13 years ago

Same problem here, with the same version information as jimcook.

saturnjct commented 13 years ago

Is it possible it's the same type of problem described here? http://mercurial.selenic.com/bts/issue1476

saturnjct commented 13 years ago

My failure was trying to clone the hg-git code. I was able to successfully clone git://git.sv.gnu.org/automake.git so my guess it's something specific to the hg-git repository.

joewalker commented 13 years ago

Same problem while syncing (and converting) bespin/skywriter from hg to git. Versions as previously reported except Hg version 1.6.3

rohitbrai commented 13 years ago

I am also having the same issue while trying to pull from Skywriter.

rsvp commented 13 years ago

The problem appears even when one tries to clone the hg-git extension from github! Would strongly recommend supplementing "self clone" to the test suite ;-)

A related problem which looks similar has a traceback:
http://selenic.com/pipermail/mercurial/2010-February/030104.html on which Augie Fackler comments. Maybe one must use the correct dulwich version to avoid ".../dulwich/object_store.py in get_raw -- raise KeyError(hexsha)"

These two bugs appear in recently updated Ubuntu 10.04 Lucid distribution. And is NOT resolved by a private install of the latest hg-git v0.2.4. So this is a serious issue.

Thanks Scott for looking into this. [Enjoyed your talk at PyCon2010 on hg-git BTW ;-]

abderrahim commented 13 years ago

I've tried to find the cause of this bug, and it' a really complicated one (and I'd blame the rebase extension btw). (the traceback in the mail on which Augie comments isn't related to this bug AFAICT)

The offending commit (the one that cannot be converted back) is this one (in hg-git, I haven't tried skywriter yet):

commit f1f633dffb5fbe33b5c8e891b2c8d687f2fd1264
...
    --HG--
    rename : git_handler.py => hggit/git_handler.py
    extra : rebase_source : df4c28417f49a04c96351c59fac77118b432ab88

while there is actually no rename in this commit, the rename git_handler.py => hggit/git_handler.py happened way before this. Looking closer (using mercurial's Python API : it's really nice to have everything accessible from a shell) the problem is that the filenode for hggit/git_handler.py in this commit is a root node (i.e. a node with no anscestor). I think this shouldn't happen (mercurial shouldn't do this), and that's why I think it's a bug in rebase.

Even though I think this isn't really a bug, I guess it needs a workaround in hg-git.

XMLSDK commented 12 years ago

Same error when: hg clone git://github.com/schacon/hg-git.git TypeError: b2a_hex() argument 1 must be string or read-only buffer, not None

This error does not happen to other git repo, e.g. hg clone git://github.com/schacon/munger.git