changeset 52283:fad30cb98579

histedit-continue: wire up `hg continue` and `histedit`
author Brian Hulette <bhulette@apache.org>
date Wed, 30 Oct 2024 19:38:56 -0700
parents 51a350a22d0c
children f4aede0f01af
files hgext/histedit.py tests/test-histedit-arguments.t tests/test-histedit-base.t tests/test-histedit-edit.t tests/test-histedit-fold-non-commute.t tests/test-histedit-fold.t tests/test-histedit-non-commute.t tests/test-histedit-obsolete.t
diffstat 8 files changed, 29 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Wed Nov 20 15:53:19 2024 +0100
+++ b/hgext/histedit.py	Wed Oct 30 19:38:56 2024 -0700
@@ -2348,6 +2348,21 @@
     return state
 
 
+def hgcontinuehistedit(ui, repo):
+    fm = ui.formatter(b'continue', {})
+    fm.startitem()
+
+    state = histeditstate(repo)
+    with repo.wlock() as wlock, repo.lock() as lock:
+        state.wlock = wlock
+        state.lock = lock
+        state.read()
+        state = bootstrapcontinue(ui, state, None)
+        _continuehistedit(ui, repo, state)
+        _finishhistedit(ui, repo, state, fm)
+        fm.end()
+
+
 def between(repo, old, new, keep):
     """select and validate the set of revision to edit
 
@@ -2683,4 +2698,5 @@
         allowcommit=True,
         continueflag=True,
         abortfunc=hgaborthistedit,
+        continuefunc=hgcontinuehistedit,
     )
--- a/tests/test-histedit-arguments.t	Wed Nov 20 15:53:19 2024 +0100
+++ b/tests/test-histedit-arguments.t	Wed Oct 30 19:38:56 2024 -0700
@@ -163,7 +163,7 @@
   $ echo alpha >> alpha
   $ mv .hg/histedit-state.back .hg/histedit-state
 
-  $ hg histedit --continue
+  $ hg continue
   saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg
   $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2::
   @  4 f5ed five
--- a/tests/test-histedit-base.t	Wed Nov 20 15:53:19 2024 +0100
+++ b/tests/test-histedit-base.t	Wed Oct 30 19:38:56 2024 -0700
@@ -183,7 +183,7 @@
   $ hg resolve --mark B
   (no more unresolved files)
   continue: hg histedit --continue
-  $ hg histedit --continue | fixbundle
+  $ hg continue | fixbundle
   $ hg tglog
   @  6:03772da75548bb42a8f1eacd8c91d0717a147fcd:draft 'X'
   |
--- a/tests/test-histedit-edit.t	Wed Nov 20 15:53:19 2024 +0100
+++ b/tests/test-histedit-edit.t	Wed Oct 30 19:38:56 2024 -0700
@@ -264,7 +264,7 @@
 (test also that editor is invoked if histedit is continued for
 "edit" action)
 
-  $ HGEDITOR='cat' hg histedit --continue
+  $ HGEDITOR='cat' hg continue
   f
   
   
@@ -441,7 +441,7 @@
   Editing (cb9a9f314b8b), commit as needed now to split the change
   (to edit cb9a9f314b8b, `hg histedit --continue` after making changes)
   [240]
-  $ HGEDITOR=true hg histedit --continue
+  $ HGEDITOR=true hg continue
   saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-histedit.hg
 
   $ hg log -G
--- a/tests/test-histedit-fold-non-commute.t	Wed Nov 20 15:53:19 2024 +0100
+++ b/tests/test-histedit-fold-non-commute.t	Wed Oct 30 19:38:56 2024 -0700
@@ -130,7 +130,7 @@
   (no more unresolved files)
   continue: hg histedit --continue
   $ hg diff
-  $ hg histedit --continue 2>&1 | fixbundle
+  $ hg continue 2>&1 | fixbundle
   7f3755409b00: skipping changeset (no changes)
 
 log after edit
@@ -269,7 +269,7 @@
   $ hg resolve --mark e
   (no more unresolved files)
   continue: hg histedit --continue
-  $ hg histedit --continue 2>&1 | fixbundle
+  $ hg continue 2>&1 | fixbundle
   7f3755409b00: skipping changeset (no changes)
 
 log after edit
--- a/tests/test-histedit-fold.t	Wed Nov 20 15:53:19 2024 +0100
+++ b/tests/test-histedit-fold.t	Wed Oct 30 19:38:56 2024 -0700
@@ -378,7 +378,7 @@
   $ hg commit -m '+5.2'
   created new head
   $ echo 6 >> file
-  $ HGEDITOR=cat hg histedit --continue
+  $ HGEDITOR=cat hg continue
   +4
   ***
   +5.2
--- a/tests/test-histedit-non-commute.t	Wed Nov 20 15:53:19 2024 +0100
+++ b/tests/test-histedit-non-commute.t	Wed Oct 30 19:38:56 2024 -0700
@@ -161,7 +161,7 @@
   (hg histedit --continue to resume)
 We forcibly enable curses here so we can verify that continuing works
 with curses enabled.
-  $ hg histedit --continue --config ui.interactive=true \
+  $ hg continue --config ui.interactive=true \
   >   --config ui.interface=curses 2>&1 | fixbundle
   abort: unresolved merge conflicts (see 'hg help resolve')
 
@@ -176,7 +176,7 @@
   $ hg resolve --mark e
   (no more unresolved files)
   continue: hg histedit --continue
-  $ hg histedit --continue 2>&1 | fixbundle
+  $ hg continue 2>&1 | fixbundle
   7b4e2f4b7bcd: skipping changeset (no changes)
 
 log after edit
@@ -258,7 +258,7 @@
   $ hg resolve --mark e
   (no more unresolved files)
   continue: hg histedit --continue
-  $ hg histedit --continue 2>&1 | fixbundle
+  $ hg continue 2>&1 | fixbundle
   7b4e2f4b7bcd: skipping changeset (no changes)
 
 post message fix
--- a/tests/test-histedit-obsolete.t	Wed Nov 20 15:53:19 2024 +0100
+++ b/tests/test-histedit-obsolete.t	Wed Oct 30 19:38:56 2024 -0700
@@ -80,7 +80,7 @@
   $ hg commit --amend -X . -m XXXXXX
   $ hg commit --amend -X . -m b2
   $ hg --hidden --config extensions.strip= strip 'desc(XXXXXX)' --no-backup
-  $ hg histedit --continue
+  $ hg continue
   $ hg log -G
   @  8:273c1f3b8626 c
   |
@@ -363,7 +363,7 @@
   (to edit b449568bf7fc, `hg histedit --continue` after making changes)
   [240]
   $ echo f >> f
-  $ hg histedit --continue
+  $ hg continue
   $ hg log -G
   @  24:12e89af74238 (secret) k
   |
@@ -569,7 +569,7 @@
   Editing (ee118ab9fa44), commit as needed now to split the change
   (to edit ee118ab9fa44, `hg histedit --continue` after making changes)
   [240]
-  $ hg histedit --continue --config experimental.evolution.track-operation=1
+  $ hg continue --config experimental.evolution.track-operation=1
   $ hg log -G
   @  23:175d6b286a22 (secret) k
   |