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

Crash in pull after a few pulls - and perhaps a push #90

Closed kiilerix closed 10 years ago

kiilerix commented 14 years ago
** Mercurial Distributed SCM (version 1.5)
** Extensions loaded: hg-git
Traceback (most recent call last):
  File "/usr/bin/hg", line 27, in 
    mercurial.dispatch.run()
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 16, in run
    sys.exit(dispatch(sys.argv[1:]))
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 30, in dispatch
    return _runcatch(u, args)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 47, in _runcatch
    return _dispatch(ui, args)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 466, in _dispatch
    return runcommand(lui, repo, cmd, fullargs, ui, options, d)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 336, in runcommand
    ret = _runcommand(ui, options, cmd, d)
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 517, in _runcommand
    return checkargs()
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 471, in checkargs
    return cmdfunc()
  File "/usr/lib/python2.6/site-packages/mercurial/dispatch.py", line 465, in 
    d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
  File "/usr/lib/python2.6/site-packages/mercurial/util.py", line 401, in check
    return func(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/mercurial/commands.py", line 2402, in pull
    modheads = repo.pull(other, heads=revs, force=opts.get('force'))
  File "/home/mk/hg-git/hggit/hgrepo.py", line 12, in pull
    git.fetch(remote.path, heads)
  File "/home/mk/hg-git/hggit/git_handler.py", line 95, in fetch
    refs = self.fetch_pack(remote, heads)
  File "/home/mk/hg-git/hggit/git_handler.py", line 615, in fetch_pack
    f.write, self.ui.status)
  File "/usr/lib/python2.6/site-packages/dulwich/client.py", line 336, in fetch_pack
    progress)
  File "/usr/lib/python2.6/site-packages/dulwich/client.py", line 166, in fetch_pack
    have = graph_walker.next()
  File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 726, in next
    ps = self.get_parents(ret)
  File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 234, in 
    return ObjectStoreGraphWalker(heads, lambda sha: self[sha].parents)
  File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 100, in __getitem__
    type, uncomp = self.get_raw(sha)
  File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 317, in get_raw
    raise KeyError(hexsha)
KeyError: '02b00820423dfcf3270de966d0ab3b1c098e9bf2'

Using latest dulwich and latest hg-git

durin42 commented 14 years ago

Need significantly more information to diagnose. Is this only a particular repo? Is it public?

kiilerix commented 14 years ago

It is git+ssh://kiilerix@freerdp.git.sourceforge.net/gitroot/freerdp/freerdp and is thus password-protected. It is not reproducible in new repos, but I have seen it a couple of times - and a new clone works fine.

I haven't seen it on other git repos, but this is the only one I have push access to.

Can it be be caused by qpush and qpush until qfin and push?

Or ... perhaps it is related to the .git folder that sometimes appears and I might have messed too much with?

Can I do something to debug in my local failing repo?

rctay commented 14 years ago

What does

$ git --git-dir=.hg/git show --pretty=raw 02b00820423dfcf3270de966d0ab3b1c098e9bf2 | head

give?

If it's not there, there might be stale mappings in your git-mapfile.

abderrahim commented 14 years ago

I have the same issue here (with the hg-git repo, trying to pull rctay's rc/fix-ann-tags ). It is caused by stale mappings, but 'hg git-cleanup' didn't fix it. The problem is that an hg commit is mapped to an unexisting git commit (and I have no idea how this happened). Anyway, hg gc && hg gex fixes the problem.

kiilerix commented 14 years ago

rctay: there is no .hg/git .

There is however a .git (which I assumed was created by some git-version-gen).

I just noticed that inside my working directory "freerdp" there is subfolder "freerdp" with another working directory.

Regarding mapfile I have .hg/git-mapfile, both in the strange nested repo and in the fine new repo:

02b00820423dfcf3270de966d0ab3b1c098e9bf2 e73ad6b126a394c1ed1cbd2447b4e12b1b32e8c5

The nested repo further have freerdp/.git/refs/heads/master

02b00820423dfcf3270de966d0ab3b1c098e9bf2

This report is a bit confusing. I'm "glad" abderrahim saw it too, and I will keep an eye open if it happens again.

[argh. I am no friend of github and its markup.]

kiilerix commented 14 years ago

Got it again.

  File "/usr/lib/python2.6/site-packages/dulwich/object_store.py", line 317, in get_raw
    raise KeyError(hexsha)
KeyError: '498d38a8a89bd3ff06772aa7d27f9d5b2275e8ff'
fatal: The remote end hung up unexpectedly

$ grep -r 498d38a8a89bd3ff06772aa7d27f9d5b2275e8ff .
./.hg/git-mapfile:498d38a8a89bd3ff06772aa7d27f9d5b2275e8ff 9a2348f860349e3806b964545f64740206139e13
./.git/refs/heads/master:498d38a8a89bd3ff06772aa7d27f9d5b2275e8ff
$ ls -lrt $(find -type f)|tail
-rw-rw-r-- 1 mk mk 772480 2010-03-28 20:40 ./freerdp-UNKNOWN.tar.gz
-rw------- 1 mk mk      0 2010-03-28 20:45 ./.git/objects/pack/tmpBFSU9L.pack
-rwxrwxr-x 1 mk mk      0 2010-03-28 20:45 ./.git/info/excludes
-rwxrwxr-x 1 mk mk     24 2010-03-28 20:45 ./.git/HEAD
-rwxrwxr-x 1 mk mk     18 2010-03-28 20:45 ./.git/description
-rwxrwxr-x 1 mk mk    104 2010-03-28 20:45 ./.git/config
-rw-rw-r-- 1 mk mk  44280 2010-03-31 11:57 ./.hg/git-mapfile
-rwxrwxr-x 1 mk mk     41 2010-03-31 11:57 ./.git/refs/heads/master
-rwxrwxr-x 1 mk mk     41 2010-03-31 11:57 ./.git/refs/heads/maint
-rw------- 1 mk mk      0 2010-03-31 11:57 ./.git/objects/pack/tmpTlrtUw.pack

hg gc followed by pull fixed it.

intel352 commented 12 years ago

@kiilerix, thanks for reporting the fix/workaround, worked for me just now. excellent!