glandium / git-cinnabar

git remote helper to interact with mercurial repositories
GNU General Public License v2.0
295 stars 61 forks source link

Exception when cloning hg.adblockplus.org/ruadlist #242

Closed gwarser closed 4 years ago

gwarser commented 4 years ago
[rdk@on filter lists]$ git clone hg::https://hg.adblockplus.org/ruadlist
Cloning into 'ruadlist'...
Reading 38731 changesets
Reading and importing 38721 manifests
Reading and importing 55500 revisions of 122 files
fatal: Invalid dataref: M 040000 ('4b825dc642cb6eb9a060e54bf8d69288fbee4904',) 
fast-import: dumping crash report to /media/XXX/git/filter lists/ruadlist/.git/fast_import_crash_30856
Importing 1 changesets
Traceback (most recent call last):
  File "/opt/git-cinnabar/cinnabar/util.py", line 932, in run
    retcode = func(args)
  File "/usr/bin/git-remote-hg", line 49, in main
    helper.run()
  File "/opt/git-cinnabar/cinnabar/remote_helper.py", line 97, in run
    func(*args)
  File "/opt/git-cinnabar/cinnabar/remote_helper.py", line 401, in import_
    self._branchmap.names())
  File "/opt/git-cinnabar/cinnabar/hg/repo.py", line 989, in getbundle
    apply_bundle(store)
  File "/opt/git-cinnabar/cinnabar/hg/repo.py", line 862, in __call__
    store.store_changeset(cs)
  File "/opt/git-cinnabar/cinnabar/githg.py", line 1143, in store_changeset
    GitHgHelper.set(b'changeset-metadata', instance.node, b':1')
  File "/opt/git-cinnabar/cinnabar/helper.py", line 348, in set
    self.git2hg.invalidate(self, self.hg2git(args[1]))
  File "/opt/git-cinnabar/cinnabar/util.py", line 502, in wrapper
    result = func(*args)
  File "/opt/git-cinnabar/cinnabar/helper.py", line 288, in hg2git
    assert sha1[-1:] == b'\n'
AssertionError
fatal: could not read ref refs/cinnabar/refs/heads/branches/default/tip
[rdk@on filter lists]$ git cinnabar python -c "import sys; from mercurial import util; print(util.version(), sys.version_info)"
('5.3', sys.version_info(major=2, minor=7, micro=17, releaselevel='final', serial=0))
[rdk@on ~]$ uname -a
Linux on 5.4.23-1-MANJARO #1 SMP PREEMPT Fri Feb 28 22:45:29 UTC 2020 x86_64 GNU/Linux

git-cinnabar from AUR: https://aur.archlinux.org/packages/git-cinnabar

Python 3? ``` [rdk@on filter lists]$ export GIT_CINNABAR_EXPERIMENTS=python3 [rdk@on filter lists]$ git cinnabar python -c "import sys; from mercurial import util; print(util.version(), sys.version_info)" Traceback (most recent call last): File "", line 1, in ImportError: cannot import name 'util' from 'mercurial' (unknown location) [rdk@on filter lists]$ git clone hg::https://hg.adblockplus.org/ruadlist Cloning into 'ruadlist'... WARNING Mercurial libraries not found. Falling back to experimental native access. Reading 38731 changesets Reading and importing 38721 manifests Reading and importing 55500 revisions of 122 files Importing 1 changesets Traceback (most recent call last): File "/opt/git-cinnabar/cinnabar/util.py", line 932, in run retcode = func(args) File "/usr/bin/git-remote-hg", line 49, in main helper.run() File "/opt/git-cinnabar/cinnabar/remote_helper.py", line 97, in run func(*args) File "/opt/git-cinnabar/cinnabar/remote_helper.py", line 400, in import_ getbundle(self._repo, self._store, heads, File "/opt/git-cinnabar/cinnabar/hg/repo.py", line 989, in getbundle apply_bundle(store) File "/opt/git-cinnabar/cinnabar/hg/repo.py", line 862, in __call__ store.store_changeset(cs) File "/opt/git-cinnabar/cinnabar/githg.py", line 1130, in store_changeset c.filemodify(b'', self.git_tree(instance.manifest, File "/opt/git-cinnabar/cinnabar/helper.py", line 545, in filemodify self.write(b'M %s %s %s\n' % ( TypeError: %b requires a bytes-like object, or an object that implements __bytes__, not 'tuple' fatal: could not read ref refs/cinnabar/refs/heads/branches/default/tip [rdk@on filter lists]$ ```
glandium commented 4 years ago

This has been broken since 0.5.0b1, by f603999bea016e4cd46ccda4b40a1c30f0a2e391.

glandium commented 4 years ago

Fixed in 4195739b225b2ab7f8a48cfc65c5992f14bf6663. Thank you.