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

KeyError on push #234

Closed boris-unterer closed 10 years ago

boris-unterer commented 12 years ago

Hi I've got this excpetion with hg-git bd233a168251 and dulwich 0.8.0 (both the latest versions of today). any idea?

* unknown exception encountered, please report by visiting * http://mercurial.selenic.com/wiki/BugTracker * Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01) [GCC 4.3.4 20090804 (release) 1] * Mercurial Distributed SCM (version 1.9.2) * Extensions loaded: hgsubversion, hggit, convert, children, churn, color, extdiff, fetch, gpg, mq, graphlog, keyword, purge, rebase, record, transplant, hgk, share Traceback (most recent call last): File "/usr/bin/hg", line 38, in mercurial.dispatch.run() File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 27, in run sys.exit(dispatch(request(sys.argv[1:]))) File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 64, in dispatch return _runcatch(req) File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 87, in _runcatch return _dispatch(req) File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 688, in _dispatch cmdpats, cmdoptions) File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 463, in runcommand ret = _runcommand(ui, options, cmd, d) File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 182, in wrap return wrapper(origfn, _args, kwargs) File "/usr/lib/python2.6/site-packages/hgext/color.py", line 368, in colorcmd return orig(ui, opts, cmd, cmdfunc) File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 742, in _runcommand return checkargs() File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 696, in checkargs return cmdfunc() File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 685, in d = lambda: util.checksignature(func)(ui, _args, _cmdoptions) File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 385, in check return func(_args, _kwargs) File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 137, in wrap util.checksignature(origfn), _args, _kwargs) File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 385, in check return func(_args, _kwargs) File "/home/Administrator/hgsubversion/hgsubversion/wrappers.py", line 524, in generic return orig(ui, repo, _args, _opts) File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 385, in check return func(_args, _kwargs) File "/usr/lib/python2.6/site-packages/mercurial/extensions.py", line 137, in wrap util.checksignature(origfn), _args, _kwargs) File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 385, in check return func(_args, _kwargs) File "/usr/lib/python2.6/site-packages/hgext/mq.py", line 3218, in mqcommand return orig(ui, repo, _args, _kwargs) File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 385, in check return func(_args, _kwargs) File "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 3886, in push newbranch=opts.get('new_branch')) File "/home/Administrator/hg-git.git/hggit/hgrepo.py", line 22, in push git.push(remote.path, revs, force) File "/home/Administrator/hg-git.git/hggit/git_handler.py", line 227, in push changed_refs = self.upload_pack(remote, revs, force) File "/home/Administrator/hg-git.git/hggit/git_handler.py", line 701, in upload_pack changed_refs = client.send_pack(path, changed, genpack) File "/usr/lib/python2.6/site-packages/dulwich/client.py", line 187, in send_pack entries, sha = write_pack_objects(proto.write_file(), objects) File "/usr/lib/python2.6/site-packages/dulwich/pack.py", line 1504, in write_pack_objects num_objects = len(objects) File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 674, in len return len(list(self.itershas())) File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 648, in itershas for sha in self.sha_iter: File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 741, in next o = self.object_store[sha] File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 112, in getitem type_num, uncomp = self.get_raw(sha) File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 313, in get_raw raise KeyError(hexsha) KeyError: 'd2040defc9d53602a6fee9d266e6216c38850b56'

tavisrudd commented 12 years ago

I'm seeing exactly the same thing on pushing to a remote git repo that I created via hg-git and have pushed to successfully in the past. I'm using the current heads of hg-git and dulwich and hg 2.0.1

tavisrudd commented 12 years ago

This also happens when I push to a brand new bare git repo and it happens with hg versions from 1.8 through 2.0.2.

intel352 commented 12 years ago

I'm having a similar issue with an hg repo that I updated 2 days ago to push to a github repository. It worked that first day. Last night and today, on two different systems (Windows, Mac), I've attempted pushing the latest changes to github, no dice.... :-\

Line numbers are different between the OP error and my own error output, but otherwise it's pretty much identical.

intel352 commented 12 years ago

Just an update, per #90, a workaround is to hg gc to clean up git, then hg pull. Worked for me

ghost commented 11 years ago

I had the exact same problem when trying to push a mercurial repo to github. I just ran 'hg gc && hg gex' and the push worked.

vlad0337187 commented 6 years ago

It appears very often. just need to make "hg gc" and then repeat pushing - all was well. OS: Linux Mint 18.2 mercurial-git plugin was installed from repository, version: 0.8.5-2