Mercurial > evolve
changeset 4800:fa534a8c5863
pick: added support for hg abort
This patch isolates abort logic for `hg pick --abort`
as `abortpick()`. For independent calls via `hg abort`
`hgabortpick()` is created and registered to the state
detection API.
Results are shown as tests.
author | Taapas Agrawal <taapas2897@gmail.com> |
---|---|
date | Tue, 06 Aug 2019 00:16:05 +0200 |
parents | 6f9e66433ff8 |
children | 16c1398b0063 |
files | CHANGELOG hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py tests/test-pick.t |
diffstat | 4 files changed, 27 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGELOG Tue Aug 06 00:16:01 2019 +0200 +++ b/CHANGELOG Tue Aug 06 00:16:05 2019 +0200 @@ -6,6 +6,7 @@ * prune: clarify error message when no revision were passed, * evolve: avoid possible race conditions bu locking earlier + * abort: add support for `evolve` and `pick` to `hg abort` (hg-5.1+) 9.1.0 -- 2019-07-29 -------------------
--- a/hgext3rd/evolve/__init__.py Tue Aug 06 00:16:01 2019 +0200 +++ b/hgext3rd/evolve/__init__.py Tue Aug 06 00:16:05 2019 +0200 @@ -1364,7 +1364,8 @@ continueflag=True, stopflag=True, statushint=_msg, abortfunc=evolvecmd.hgabortevolve) - statemod.addunfinished('pick', fname='pickstate', continueflag=True) + statemod.addunfinished('pick', fname='pickstate', continueflag=True, + abortfunc=cmdrewrite.hgabortpick) else: # compat <= hg-5.0 (5f2f6912c9e6) estate = ('evolvestate', False, False, _('evolve in progress'),
--- a/hgext3rd/evolve/cmdrewrite.py Tue Aug 06 00:16:01 2019 +0200 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Aug 06 00:16:05 2019 +0200 @@ -1535,3 +1535,9 @@ hg.updaterepo(repo, pctxnode, True) pickstate.delete() return 0 + +def hgabortpick(ui, repo): + """logic to abort pick using 'hg abort'""" + with repo.wlock(), repo.lock(): + pickstate = state.cmdstate(repo, path='pickstate') + return abortpick(ui, repo, pickstate, abortcmd=True)
--- a/tests/test-pick.t Tue Aug 06 00:16:01 2019 +0200 +++ b/tests/test-pick.t Tue Aug 06 00:16:05 2019 +0200 @@ -1,3 +1,4 @@ +#testcases abortcommand abortflag Test for the pick command $ cat >> $HGRCPATH <<EOF @@ -8,6 +9,13 @@ > EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH +#if abortflag + $ cat >> $HGRCPATH <<EOF + > [alias] + > abort = pick --abort + > EOF +#endif + $ mkcommit() { > echo "$1" > "$1" > hg add "$1" @@ -79,6 +87,11 @@ $ hg pick --abort abort: no interrupted pick state exists [255] +#if abortcommand + $ hg abort + abort: no operation in progress + [255] +#endif Specifying both continue and revs @@ -235,7 +248,11 @@ unresolved merge conflicts (see hg help resolve) [1] - $ hg pick --abort +#if abortcommand + $ hg abort --dry-run + pick in progress, will be aborted +#endif + $ hg abort aborting pick, updating to c437988de89f $ hg glog