changeset 6201:d18e16b9b793

fixup: support hg continue
author Luke Granger-Brown <hg@lukegb.com>
date Mon, 14 Mar 2022 16:46:38 +0000
parents ceab1399302c
children fe8e88ea296d
files hgext3rd/evolve/__init__.py hgext3rd/evolve/cmdrewrite.py tests/test-fixup.t
diffstat 3 files changed, 52 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/__init__.py	Tue Mar 15 19:29:17 2022 +0300
+++ b/hgext3rd/evolve/__init__.py	Mon Mar 14 16:46:38 2022 +0000
@@ -1176,7 +1176,8 @@
                        b'To abort:       hg fixup --abort\n')
         statemod.addunfinished(b'fixup', fname=b'fixup-state',
                                continueflag=True, statushint=_fixup_msg,
-                               abortfunc=cmdrewrite.hgabortfixup)
+                               abortfunc=cmdrewrite.hgabortfixup,
+                               continuefunc=cmdrewrite.hgcontinuefixup)
     else:
         # hg <= 5.0 (5f2f6912c9e6)
         estate = (b'evolvestate', False, False, _(b'evolve in progress'),
--- a/hgext3rd/evolve/cmdrewrite.py	Tue Mar 15 19:29:17 2022 +0300
+++ b/hgext3rd/evolve/cmdrewrite.py	Mon Mar 14 16:46:38 2022 +0000
@@ -1589,6 +1589,13 @@
         compat.update(repo.unfiltered()[tempnode])
         return 0
 
+def hgcontinuefixup(ui, repo):
+    """logic for handling `hg continue' for fixup"""
+    with repo.wlock(), repo.lock():
+        fixup_state = state.cmdstate(repo, b'fixup-state')
+        fixup_state.load()
+        return continuefixup(ui, repo, fixup_state)
+
 def abortfixup(ui, repo, fixup_state):
     """logic for handling of `hg fixup --abort`"""
     with repo.wlock(), repo.lock():
--- a/tests/test-fixup.t	Tue Mar 15 19:29:17 2022 +0300
+++ b/tests/test-fixup.t	Mon Mar 14 16:46:38 2022 +0000
@@ -258,6 +258,43 @@
   1 files updated, 0 files merged, 2 files removed, 0 files unresolved
   working directory is now at fed7e534b3bb
 
+testing continue command
+
+  $ hg up -r 'desc("baz")'
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo 'not foo' > foo
+
+  $ 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]
+  $ echo 'bonjour fixed' > foo
+  $ hg resolve --mark foo
+  (no more unresolved files)
+  continue: hg fixup --continue
+
+  $ hg continue
+  evolving 14:6b0b1270d7dd "temporary fixup commit"
+
+  $ hg glog
+  o  16:0dd54868f420 update foo
+  |   () draft
+  | @  14:6b0b1270d7dd temporary fixup commit
+  | |   () secret
+  | o  9:12b5e442244f baz
+  | |   () secret
+  | o  5:2eec5320cfc7 bar
+  |/    () draft
+  o  0:e63c23eaa88a foo
+      () draft
+
+  $ hg evolve
+  update:[16] update foo
+  1 files updated, 0 files merged, 2 files removed, 0 files unresolved
+  working directory is now at 0dd54868f420
+
 amending a descendant of wdp
 
   $ hg up 0
@@ -266,11 +303,11 @@
   $ hg add foobar
   $ hg fixup -r 'desc(baz)'
   $ hg glog
-  o  16:b50fd0850076 baz
+  o  19:b50fd0850076 baz
   |   () secret
-  | @  14:4a9c4d14d447 temporary fixup commit
+  | @  17:4a9c4d14d447 temporary fixup commit
   | |   () draft
-  | | o  13:fed7e534b3bb update foo
+  | | o  16:0dd54868f420 update foo
   | |/    () draft
   o |  5:2eec5320cfc7 bar
   |/    () draft
@@ -278,14 +315,14 @@
       () draft
 
   $ hg evolve
-  update:[16] baz
+  update:[19] baz
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
   working directory is now at b50fd0850076
 
   $ hg glog
-  @  16:b50fd0850076 baz
+  @  19:b50fd0850076 baz
   |   () secret
-  | o  13:fed7e534b3bb update foo
+  | o  16:0dd54868f420 update foo
   | |   () draft
   o |  5:2eec5320cfc7 bar
   |/    () draft