hg incoming (after strip / git-cleanup): 'overlayrepo' object has no attribute 'githandler'
Created originally on Bitbucket by muxator
- python: 2.7.14 (from ubuntu bionic repo)
- dulwich: 0.18.5 (from ubuntu bionic repo)
- mercurial: 4.5.3 (built with
make deb
) - hg-git: 0.8.11 (b90c69681d2d)
When invoking hg incoming
on a repository that had some commit stripped, it seems that hg-git no longer recognizes itself.
hg pull
still works.
Test case on a github repository with just 2 commits.
Setup:
~$ hg clone git+https://github.com/rtyley/small-test-repo.git
destination directory: small-test-repo
importing git objects into hg
updating to branch default
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
~$ cd small-test-repo/
At first, hg incoming works as expected.
~/small-test-repo$ hg incoming
comparing with git+https://github.com/rtyley/small-test-repo.git
no changes found
Let's strip the last commit:
~/small-test-repo$ hg strip -r tip
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
saved backup bundle to ~/small-test-repo/.hg/strip-backup/6c1edf335a95-cec39c48-backup.hg
hg incoming
does not work (this is not very surprising: we did not call hg git-cleanup
)
~/small-test-repo$ hg incoming
comparing with git+https://github.com/rtyley/small-test-repo.git
no changes found
Let's do the compulsory hg git-cleanup
:
~/small-test-repo$ hg git-cleanup
git commit map cleaned
Now hg incoming
breaks:
~/small-test-repo$ hg incoming
comparing with git+https://github.com/rtyley/small-test-repo.git
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 2.7.14+ (default, Apr 2 2018, 04:16:25) [GCC 7.3.0]
** Mercurial Distributed SCM (version 4.5.3+4-386aaa01ffa7+20180415)
** Extensions loaded: convert, extdiff, hggit, strip, mq, rebase, shelve, uncommit, show
Traceback (most recent call last):
File "/usr/bin/hg", line 41, in <module>
dispatch.run()
File "/usr/lib/python2.7/dist-packages/mercurial/dispatch.py", line 88, in run
status = (dispatch(req) or 0) & 255
[...]
File "/usr/lib/python2.7/dist-packages/hgext/mq.py", line 3583, in mqcommand
return orig(ui, repo, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1195, in check
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/mercurial/commands.py", line 3183, in incoming
return hg.incoming(ui, repo, source, opts)
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 919, in incoming
return _incoming(display, subreporecurse, ui, repo, source, opts)
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 889, in _incoming
displaychlist(other, chlist, displayer)
File "/usr/lib/python2.7/dist-packages/mercurial/hg.py", line 918, in display
displayer.show(other[n])
File "/usr/lib/python2.7/dist-packages/mercurial/cmdutil.py", line 1695, in show
self._show(ctx, copies, matchfn, hunksfilterfn, props)
File "/usr/lib/python2.7/dist-packages/mercurial/cmdutil.py", line 2007, in _show
self.ui.write(templater.stringify(self.t(key, **props)))
File "/usr/lib/python2.7/dist-packages/mercurial/templatefilters.py", line 372, in stringify
return "".join([stringify(t) for t in thing if t is not None])
File "/usr/lib/python2.7/dist-packages/mercurial/util.py", line 1017, in increasingchunks
for chunk in source:
File "/usr/lib/python2.7/dist-packages/mercurial/templater.py", line 1281, in _flatten
for j in _flatten(i):
[...]
File "/usr/lib/python2.7/dist-packages/mercurial/templater.py", line 1272, in _flatten
for i in thing:
File "/usr/lib/python2.7/dist-packages/mercurial/templater.py", line 795, in if_
test = evalboolean(context, mapping, args[0])
File "/usr/lib/python2.7/dist-packages/mercurial/templater.py", line 327, in evalboolean
thing = func(context, mapping, data, default=None)
File "/usr/lib/python2.7/dist-packages/mercurial/templater.py", line 404, in runsymbol
return v(**pycompat.strkwargs(props))
File "/opt/mercurial/hg-git/hggit/__init__.py", line 429, in gitnodekw
gitnode = repo.githandler.map_git_get(node.hex())
AttributeError: 'overlayrepo' object has no attribute 'githandler'
The key issue seems to be that repo
no longer appear to be a "gitified" repository (it has no githandler
attribute now).
On the other hand, hg pull
works as expected, pulling back in the change we just stripped:
~/small-test-repo$ hg pull
pulling from git+https://github.com/rtyley/small-test-repo.git
importing git objects into hg
(run 'hg update' to get a working copy)