changeset 6200:ceab1399302c

pick: support hg continue
author Luke Granger-Brown <hg@lukegb.com>
date Tue, 15 Mar 2022 19:29:17 +0300
parents 09754e40d2db
children d18e16b9b793
files hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py tests/test-pick.t
diffstat 3 files changed, 29 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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',
--- 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:
--- 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
@@ -9,10 +9,11 @@
   > EOF
   $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
 
-#if abortflag
+#if abortcontinueflag
   $ cat >> $HGRCPATH <<EOF
   > [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