# HG changeset patch # User Anton Shestakov # Date 1646577851 -10800 # Node ID 4a837da84f5f9acd0b525bedc89617bf87427100 # Parent 9e0aa8929206db3080cc434089978384077c03fe fixup: allow to be aborted using hg abort diff -r 9e0aa8929206 -r 4a837da84f5f hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Sun Mar 06 18:15:54 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 9e0aa8929206 -r 4a837da84f5f hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Sun Mar 06 18:15:54 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 9e0aa8929206 -r 4a837da84f5f tests/test-fixup.t --- a/tests/test-fixup.t Sun Mar 06 18:15:54 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")'