# HG changeset patch # User Luke Granger-Brown # Date 1647361757 -10800 # Node ID ceab1399302c71d4f5af66f147fc2d13adbe019d # Parent 09754e40d2db590c97224079771ffd083ad91614 pick: support hg continue diff -r 09754e40d2db -r ceab1399302c hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Tue Mar 15 19:28:17 2022 +0300 +++ b/hgext3rd/evolve/__init__.py Tue Mar 15 19:29:17 2022 +0300 @@ -1170,7 +1170,8 @@ abortfunc=evolvecmd.hgabortevolve, continuefunc=evolvecmd.hgcontinueevolve) statemod.addunfinished(b'pick', fname=b'pickstate', continueflag=True, - abortfunc=cmdrewrite.hgabortpick) + abortfunc=cmdrewrite.hgabortpick, + continuefunc=cmdrewrite.hgcontinuepick) _fixup_msg = _(b'To continue: hg fixup --continue\n' b'To abort: hg fixup --abort\n') statemod.addunfinished(b'fixup', fname=b'fixup-state', diff -r 09754e40d2db -r ceab1399302c hgext3rd/evolve/cmdrewrite.py --- a/hgext3rd/evolve/cmdrewrite.py Tue Mar 15 19:28:17 2022 +0300 +++ b/hgext3rd/evolve/cmdrewrite.py Tue Mar 15 19:29:17 2022 +0300 @@ -1430,6 +1430,15 @@ return 0 +def hgcontinuepick(ui, repo): + """logic to continue pick using 'hg continue'""" + with repo.wlock(), repo.lock(): + pickstate = state.cmdstate(repo, path=b'pickstate') + pickstate.load() + orignode = pickstate[b'orignode'] + origctx = repo[orignode] + return _dopick(ui, repo, pickstate, origctx) + def abortpick(ui, repo, pickstate, abortcmd=False): """logic to abort pick""" if not pickstate and not abortcmd: diff -r 09754e40d2db -r ceab1399302c tests/test-pick.t --- a/tests/test-pick.t Tue Mar 15 19:28:17 2022 +0300 +++ b/tests/test-pick.t Tue Mar 15 19:29:17 2022 +0300 @@ -1,4 +1,4 @@ -#testcases abortcommand abortflag +#testcases abortcontinuecommand abortcontinueflag Test for the pick command $ cat >> $HGRCPATH < EOF $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH -#if abortflag +#if abortcontinueflag $ cat >> $HGRCPATH < [alias] > abort = pick --abort + > continue = pick --continue > EOF #endif @@ -83,13 +84,18 @@ $ hg pick --continue abort: no interrupted pick state exists [255] +#if abortcontinuecommand + $ hg continue + abort: no operation in progress + [20] +#endif Aborting without interrupted pick $ hg pick --abort abort: no interrupted pick state exists [255] -#if abortcommand +#if abortcontinuecommand $ hg abort abort: no operation in progress [20] @@ -205,7 +211,11 @@ $ hg resolve --all --mark (no more unresolved files) continue: hg pick --continue - $ hg pick --continue +#if abortcontinuecommand + $ hg continue --dry-run + pick in progress, will be resumed +#endif + $ hg continue $ hg glog @ 8:44e155eb95c7 add c | @@ -243,7 +253,7 @@ (no more unresolved files) continue: hg pick --continue - $ hg pick --continue + $ hg continue note: picking 9:4e04628911f6 created no changes to commit Testing the abort functionality of hg pick @@ -264,7 +274,7 @@ unresolved merge conflicts (see hg help resolve) [240] -#if abortcommand +#if abortcontinuecommand $ hg abort --dry-run pick in progress, will be aborted #endif @@ -330,7 +340,7 @@ (no more unresolved files) continue: hg pick --continue - $ hg pick --continue + $ hg continue $ hg phase -r . 11: secret @@ -466,7 +476,7 @@ $ hg resolve -t :other a (no more unresolved files) continue: hg pick --continue - $ hg pick --continue + $ hg continue Demonstrate that b was not forgotten and is definitely included in 4