# HG changeset patch # User Anton Shestakov # Date 1646577851 -10800 # Node ID d2ec9ab1694e53d1b65145a4185e1a88cf8dbdc9 # Parent e2804c9ebd72b46fdefa8aace940db2065fc82c9 fixup: allow to be aborted using hg abort diff -r e2804c9ebd72 -r d2ec9ab1694e hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Thu Feb 24 14:24:50 2022 +0300 +++ b/hgext3rd/evolve/__init__.py Sun Mar 06 17:44:11 2022 +0300 @@ -1173,7 +1173,8 @@ _fixup_msg = _(b'To continue: hg fixup --continue\n' b'To abort: hg fixup --abort\n') statemod.addunfinished(b'fixup', fname=b'fixup-state', - continueflag=True, statushint=_fixup_msg) + continueflag=True, statushint=_fixup_msg, + abortfunc=cmdrewrite.hgabortfixup) else: # hg <= 5.0 (5f2f6912c9e6) estate = (b'evolvestate', False, False, _(b'evolve in progress'), diff -r e2804c9ebd72 -r d2ec9ab1694e hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Thu Feb 24 14:24:50 2022 +0300 +++ b/hgext3rd/evolve/cmdrewrite.py Sun Mar 06 17:44:11 2022 +0300 @@ -1594,3 +1594,10 @@ ui.status(_(b'working directory is now at %s\n') % pctx) fixup_state.delete() return 0 + +def hgabortfixup(ui, repo): + """logic to abort fixup using 'hg abort'""" + with repo.wlock(), repo.lock(): + fixup_state = state.cmdstate(repo, path=b'fixup-state') + fixup_state.load() + return abortfixup(ui, repo, fixup_state) diff -r e2804c9ebd72 -r d2ec9ab1694e tests/test-fixup.t --- a/tests/test-fixup.t Thu Feb 24 14:24:50 2022 +0300 +++ b/tests/test-fixup.t Sun Mar 06 17:44:11 2022 +0300 @@ -188,6 +188,19 @@ foo +update foo again +testing abort command + + $ hg fixup -r 'desc("update foo")' + merging foo + warning: conflicts while merging foo! (edit, then use 'hg resolve --mark') + unresolved merge conflicts + (see 'hg help evolve.interrupted') + [240] + + $ hg abort + fixup aborted + working directory is now at 12b5e442244f + testing --continue flag $ hg fixup -r 'desc("update foo")'