KeyError in hg fold on del ctx.extra()[b'topic']
This issue was imported from Bugzilla (issue6500).
# Original description
``````````````````````````
Not quite sure how I got here, but tip is an almost empty commit that adds a blank line for some reason.
It may have been created when attempting to fold pair of commits via histedit, which somehow ended up creating some left-over temporary commit, and also this duplicate commit.
Wasn't able to reproduce this in a smaller repo so I'm just dropping the traceback here in the hopes that it makes sense to someone.
@ 1d3e tip no-topic
| o 5701 topic
|/
o f15d topic
$ hg fold -r .+.^ --exact
transaction abort!
rollback completed
** unknown exception encountered, please report by visiting
** https://mercurial-scm.org/wiki/BugTracker
** Python 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
** Mercurial Distributed SCM (version 5.7)
** Extensions loaded: absorb, evolve 10.2.0, extdiff, fastannotate, fix, githelp, histedit, patchbomb, purge, rebase, releasenotes, relink, schemes, show, topic 0.21.0, transplant
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/mercurial/commandserver.py", line 499, in _serverequest
sv.serve()
File "/usr/lib/python3/dist-packages/mercurial/commandserver.py", line 403, in serve
while self.serveone():
File "/usr/lib/python3/dist-packages/mercurial/commandserver.py", line 377, in serveone
handler(self)
File "/usr/lib/python3/dist-packages/mercurial/chgserver.py", line 585, in runcommand
return super(chgcmdserver, self).runcommand()
File "/usr/lib/python3/dist-packages/mercurial/commandserver.py", line 358, in runcommand
ret = self._dispatchcommand(req) & 255
File "/usr/lib/python3/dist-packages/mercurial/commandserver.py", line 297, in _dispatchcommand
return dispatch.dispatch(req)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 245, in dispatch
status = _rundispatch(req)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 289, in _rundispatch
ret = _runcatch(req) or 0
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 465, in _runcatch
return _callcatch(ui, _runcatchfunc)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 475, in _callcatch
return scmutil.callcatch(ui, func)
File "/usr/lib/python3/dist-packages/mercurial/scmutil.py", line 155, in callcatch
return func()
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 455, in _runcatchfunc
return _dispatch(req)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1259, in _dispatch
lui, repo, cmd, fullargs, ui, options, d, cmdpats, cmdoptions
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 913, in runcommand
ret = _runcommand(ui, options, cmd, d)
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1270, in _runcommand
return cmdfunc()
File "/usr/lib/python3/dist-packages/mercurial/dispatch.py", line 1256, in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **strcmdopt)
File "/usr/lib/python3/dist-packages/mercurial/util.py", line 1867, in check
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/hgext3rd/evolve/cmdrewrite.py", line 745, in fold
commitopts=commitopts)
File "/usr/lib/python3/dist-packages/hgext3rd/evolve/rewriteutil.py", line 279, in rewrite
newid = repo.commitctx(new)
File "/usr/lib/python3/dist-packages/hgext3rd/topic/__init__.py", line 502, in commitctx
del ctx.extra()[constants.extrakey]
KeyError: b'topic'
``````````````````````````
# Relevant original bug metadata
| Field | Value |
| --- | --- |
| Bug ID | 6500 |
| Created on | 2021-03-21T19:06:16Z |
| Component | evolution |
| Reporter | zash (Kim "Zash" Alvefur) |
| Status | RESOLVED |
| Resolution | FIXED |
| Operating System | Linux |
| Priority | normal |
| Severity | bug |
| Mercurial version | 5.7 |
| Python version | 3.7 |
issue