Mercurial > evolve
changeset 6196:4a837da84f5f
fixup: allow to be aborted using hg abort
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Sun, 06 Mar 2022 17:44:11 +0300 |
parents | 9e0aa8929206 |
children | f1d4c9eddcc1 |
files | hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py tests/test-fixup.t |
diffstat | 3 files changed, 22 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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'),
--- 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)
--- 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")'