ApplyDeltaError: Unexpected source buffer size when force pushing a branch
In my workflow on Github, I use to force-push PR branches a lot before finally integrating them.
For some time now I randomly hit dulwich.errors.ApplyDeltaError: Unexpected source buffer size
when trying to force push a branch. I am not able to consistently generate a repo which hits the error, even because this happens in the middle of a heavy programming session, and at that time I am worried about not losing data.
My current dulwich version is dulwich==0.20.33
, mercurial 6.1, hg-git d931a1ee7e0c. Anyway, this happened even with older versions of each component.
$ hg push --bookmark some-name --force
pushing to git+ssh://git@github.com:myorg/myrepo.git
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.9.7 (default, Sep 10 2021, 14:59:43) [GCC 11.2.0]
** Mercurial Distributed SCM (version 6.1+hg2.1ceca11e6546local20220304)
** Extensions loaded: amend, churn, extdiff, hggit 0.10.4 (dulwich 0.20.33), histedit, mq, patchbomb, rebase, show, strip, uncommit
Traceback (most recent call last):
File "/usr/bin/hg", line 61, in <module>
dispatch.run()
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 144, in run
status = dispatch(req)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 250, in dispatch
status = _rundispatch(req)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 294, in _rundispatch
ret = _runcatch(req) or 0
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 470, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 480, in _callcatch
return scmutil.callcatch(ui, func)
File "/usr/lib/python3/dist-packages/mercurial/scmutil.py", line 153, in callcatch
return func()
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 460, in _runcatchfunc
return _dispatch(req)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1273, in _dispatch
return runcommand(
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 918, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1285, in _runcommand
return cmdfunc()
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1271, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/hgext/mq.py", line 4239, in mqcommand
return orig(ui, repo, *args, **kwargs)
File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1887, in check
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/mercurial/commands.py", line 5787, in push
pushop = exchange.push(
File "<base>/hg-git/hggit/util.py", line 63, in inner
return f(*args, **kwargs)
File "<base>/hg-git/hggit/__init__.py", line 592, in exchangepush
pushop.cgresult = repo.githandler.push(remote.path, revs, force)
File "<base>/hg-git/hggit/git_handler.py", line 438, in push
self.export_commits()
File "<base>/hg-git/hggit/git_handler.py", line 385, in export_commits
self.export_git_objects()
File "<base>/hg-git/hggit/git_handler.py", line 564, in export_git_objects
self.export_hg_commit(ctx.node(), exporter)
File "<base>/hg-git/hggit/git_handler.py", line 631, in export_hg_commit
commit.message, extra = self.get_git_message_and_extra(ctx)
File "<base>/hg-git/hggit/git_handler.py", line 759, in get_git_message_and_extra
message = b"".join(apply_delta(message, extra[b'message']))
dulwich.errors.ApplyDeltaError: Unexpected source buffer size: 430 vs 100
- is hg-git feeding bad data to dulwich?
- is dulwich at fault instead?
- is it possible that the
.hg/git
portion of the repo became corrupted?