Patchwork D9560: histedit: tweak `edit` message to try and guide users to our workflow

login
register
mail settings
Submitter phabricator
Date Dec. 10, 2020, 4:48 p.m.
Message ID <differential-rev-PHID-DREV-bfrsja3i3qxm6j5bfj5p-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47858/
State Superseded
Headers show

Comments

phabricator - Dec. 10, 2020, 4:48 p.m.
durin42 created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  histedit predates evolve, so it drops you on an _uncommitted_ version
  of the commit you're amending/splitting, which is in contrast to git
  which expects you to use `git commit --amend` (I think - I'm basing
  this on internal bug reports). My hope is that this output will guide
  users a little more towards the expected workflow.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D9560

AFFECTED FILES
  hgext/histedit.py
  tests/test-histedit-arguments.t
  tests/test-histedit-commute.t
  tests/test-histedit-edit.t
  tests/test-histedit-no-backup.t
  tests/test-histedit-no-change.t
  tests/test-histedit-obsolete.t
  tests/test-qrecord.t
  tests/test-rebase-pull.t

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/test-rebase-pull.t b/tests/test-rebase-pull.t
--- a/tests/test-rebase-pull.t
+++ b/tests/test-rebase-pull.t
@@ -88,8 +88,8 @@ 
   $ hg histedit . -q --commands - << EOF
   > edit d80cc2da061e histedit: generate unfinished state
   > EOF
-  Editing (d80cc2da061e), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (d80cc2da061e), commit as needed now to split the change
+  (to amend d80cc2da061e, `hg histedit --continue` after making changes)
   [240]
   $ hg pull --rebase
   abort: histedit in progress
diff --git a/tests/test-qrecord.t b/tests/test-qrecord.t
--- a/tests/test-qrecord.t
+++ b/tests/test-qrecord.t
@@ -456,8 +456,8 @@ 
   > edit ea55e2ae468f foo bar
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  Editing (ea55e2ae468f), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (ea55e2ae468f), commit as needed now to split the change
+  (to amend ea55e2ae468f, `hg histedit --continue` after making changes)
   [240]
   $ echo 'foo bar' > a
   $ hg qrecord -d '0 0' -m aaa a.patch <<EOF
diff --git a/tests/test-histedit-obsolete.t b/tests/test-histedit-obsolete.t
--- a/tests/test-histedit-obsolete.t
+++ b/tests/test-histedit-obsolete.t
@@ -43,8 +43,8 @@ 
   $ echo "pick `hg log -r 2 -T '{node|short}'`" >> plan
   $ echo "edit `hg log -r 1 -T '{node|short}'`" >> plan
   $ hg histedit -r 'all()' --commands plan
-  Editing (1b2d564fad96), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (1b2d564fad96), commit as needed now to split the change
+  (to amend 1b2d564fad96, `hg histedit --continue` after making changes)
   [240]
   $ hg st
   A b
@@ -70,8 +70,8 @@ 
   $ echo "pick `hg log -r 5 -T '{node|short}'`" >> plan
   $ echo "edit `hg log -r 4 -T '{node|short}'`" >> plan
   $ hg histedit -r 'all()' --commands plan
-  Editing (49d44ab2be1b), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (49d44ab2be1b), commit as needed now to split the change
+  (to amend 49d44ab2be1b, `hg histedit --continue` after making changes)
   [240]
   $ hg st
   A b
@@ -225,8 +225,8 @@ 
   > edit b346ab9a313d 6 c
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  Editing (b346ab9a313d), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (b346ab9a313d), commit as needed now to split the change
+  (to amend b346ab9a313d, `hg histedit --continue` after making changes)
   [240]
   $ echo c >> c
   $ hg histedit --continue
@@ -359,8 +359,8 @@ 
   > pick ee118ab9fa44 16 k
   > EOF
   0 files updated, 0 files merged, 6 files removed, 0 files unresolved
-  Editing (b449568bf7fc), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (b449568bf7fc), commit as needed now to split the change
+  (to amend b449568bf7fc, `hg histedit --continue` after making changes)
   [240]
   $ echo f >> f
   $ hg histedit --continue
@@ -401,8 +401,8 @@ 
   > pick ee118ab9fa44 16 k
   > EOF
   0 files updated, 0 files merged, 6 files removed, 0 files unresolved
-  Editing (b449568bf7fc), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (b449568bf7fc), commit as needed now to split the change
+  (to amend b449568bf7fc, `hg histedit --continue` after making changes)
   [240]
   $ echo f >> f
   $ hg histedit --continue
@@ -527,8 +527,8 @@ 
   > roll 3a6c53ee7f3d 17 j
   > edit ee118ab9fa44 18 k
   > EOF
-  Editing (ee118ab9fa44), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (ee118ab9fa44), commit as needed now to split the change
+  (to amend ee118ab9fa44, `hg histedit --continue` after making changes)
   [240]
 
 #if abortcommand
@@ -566,8 +566,8 @@ 
   > pick 3a6c53ee7f3d 17 j
   > edit ee118ab9fa44 18 k
   > EOF
-  Editing (ee118ab9fa44), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (ee118ab9fa44), commit as needed now to split the change
+  (to amend ee118ab9fa44, `hg histedit --continue` after making changes)
   [240]
   $ hg histedit --continue --config experimental.evolution.track-operation=1
   $ hg log -G
diff --git a/tests/test-histedit-no-change.t b/tests/test-histedit-no-change.t
--- a/tests/test-histedit-no-change.t
+++ b/tests/test-histedit-no-change.t
@@ -91,8 +91,8 @@ 
   | edit e860deea161a 4 e
   | pick 652413bf663e 5 f
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  Editing (e860deea161a), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (e860deea161a), commit as needed now to split the change
+  (to amend e860deea161a, `hg histedit --continue` after making changes)
   $ continueediting true "(leaving commit message unaltered)"
   % finalize changeset editing (leaving commit message unaltered)
 
@@ -142,12 +142,12 @@ 
   | edit e860deea161a 4 e
   | pick 652413bf663e 5 f
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-  Editing (055a42cdd887), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (055a42cdd887), commit as needed now to split the change
+  (to amend 055a42cdd887, `hg histedit --continue` after making changes)
   $ continueediting true "(leaving commit message unaltered)"
   % finalize changeset editing (leaving commit message unaltered)
-  Editing (e860deea161a), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (e860deea161a), commit as needed now to split the change
+  (to amend e860deea161a, `hg histedit --continue` after making changes)
   $ graphlog "log after first edit"
   % log after first edit
   @  6 e5ae3ca2f1ffdbd89ec41ebc273a231f7c3022f2 "d"
@@ -211,8 +211,8 @@ 
   $ startediting 1 1 "(not changing anything)" # edit the 3rd of 3 changesets
   % start editing the history (not changing anything)
   | edit 292aec348d9e 6 closebranch
-  Editing (292aec348d9e), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (292aec348d9e), commit as needed now to split the change
+  (to amend 292aec348d9e, `hg histedit --continue` after making changes)
   $ hg histedit --abort
 
   $ cd ..
diff --git a/tests/test-histedit-no-backup.t b/tests/test-histedit-no-backup.t
--- a/tests/test-histedit-no-backup.t
+++ b/tests/test-histedit-no-backup.t
@@ -50,8 +50,8 @@ 
   > edit 7d5187087c79 3 four
   > EOF
   merging file
-  Editing (7d5187087c79), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (7d5187087c79), commit as needed now to split the change
+  (to amend 7d5187087c79, `hg histedit --continue` after making changes)
   [240]
   $ hg abort
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
@@ -72,8 +72,8 @@ 
   > edit 7d5187087c79 3 four
   > EOF
   merging file
-  Editing (7d5187087c79), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (7d5187087c79), commit as needed now to split the change
+  (to amend 7d5187087c79, `hg histedit --continue` after making changes)
   [240]
 
   $ hg abort
diff --git a/tests/test-histedit-edit.t b/tests/test-histedit-edit.t
--- a/tests/test-histedit-edit.t
+++ b/tests/test-histedit-edit.t
@@ -75,8 +75,8 @@ 
   > pick 3c6a8ed2ebe8 g
   > EOF
   0 files updated, 0 files merged, 3 files removed, 0 files unresolved
-  Editing (e860deea161a), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (e860deea161a), commit as needed now to split the change
+  (to amend e860deea161a, `hg histedit --continue` after making changes)
 
 try to update and get an error
   $ hg update tip
@@ -205,8 +205,8 @@ 
   > pick b5f70786f9b0 g
   > EOF
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
-  Editing (1a60820cd1f6), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (1a60820cd1f6), commit as needed now to split the change
+  (to amend 1a60820cd1f6, `hg histedit --continue` after making changes)
 
   $ mv .hg/histedit-state .hg/histedit-state.bak
   $ hg strip -q -r b5f70786f9b0
@@ -247,8 +247,8 @@ 
   > edit b5f70786f9b0 f
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  Editing (b5f70786f9b0), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (b5f70786f9b0), commit as needed now to split the change
+  (to amend b5f70786f9b0, `hg histedit --continue` after making changes)
   $ hg status
   A f
 
@@ -435,8 +435,8 @@ 
   > edit cb9a9f314b8b a > $EDITED
   > EOF
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
-  Editing (cb9a9f314b8b), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (cb9a9f314b8b), commit as needed now to split the change
+  (to amend cb9a9f314b8b, `hg histedit --continue` after making changes)
   [240]
   $ HGEDITOR=true hg histedit --continue
   saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-histedit.hg
diff --git a/tests/test-histedit-commute.t b/tests/test-histedit-commute.t
--- a/tests/test-histedit-commute.t
+++ b/tests/test-histedit-commute.t
@@ -142,8 +142,8 @@ 
   > EOF
   $ HGEDITOR="cat \"$EDITED\" > " hg histedit 177f92b77385 2>&1 | fixbundle
   0 files updated, 0 files merged, 4 files removed, 0 files unresolved
-  Editing (177f92b77385), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (177f92b77385), commit as needed now to split the change
+  (to amend 177f92b77385, `hg histedit --continue` after making changes)
 
 rules should end up in .hg/histedit-last-edit.txt:
   $ cat .hg/histedit-last-edit.txt
diff --git a/tests/test-histedit-arguments.t b/tests/test-histedit-arguments.t
--- a/tests/test-histedit-arguments.t
+++ b/tests/test-histedit-arguments.t
@@ -149,8 +149,8 @@ 
   > edit 08d98a8350f3 4 five
   > EOF
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-  Editing (08d98a8350f3), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (08d98a8350f3), commit as needed now to split the change
+  (to amend 08d98a8350f3, `hg histedit --continue` after making changes)
   [240]
 
   $ hg graft --continue
@@ -335,8 +335,8 @@ 
   > edit eb57da33312f 2 three
   > pick f3cfcca30c44 4 x
   > EOF
-  Editing (eb57da33312f), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (eb57da33312f), commit as needed now to split the change
+  (to amend eb57da33312f, `hg histedit --continue` after making changes)
   [240]
   $ echo edit >> alpha
   $ hg histedit -q --continue
@@ -362,8 +362,8 @@ 
   $ hg histedit . -q --commands - << EOF
   > edit 8fda0c726bf2 6 x
   > EOF
-  Editing (8fda0c726bf2), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (8fda0c726bf2), commit as needed now to split the change
+  (to amend 8fda0c726bf2, `hg histedit --continue` after making changes)
   [240]
 Corrupt histedit state file
   $ sed 's/8fda0c726bf2/123456789012/' .hg/histedit-state > ../corrupt-histedit
@@ -496,8 +496,8 @@ 
   $ hg histedit --cont
   merging foo
   warning: conflicts while merging foo! (edit, then use 'hg resolve --mark')
-  Editing (6f2f0241f119), you may commit or record as needed now.
-  (hg histedit --continue to resume)
+  Editing (6f2f0241f119), commit as needed now to split the change
+  (to amend 6f2f0241f119, `hg histedit --continue` after making changes)
   [240]
   $ hg resolve -m --all
   (no more unresolved files)
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -799,10 +799,11 @@ 
         rulectx = repo[self.node]
         hg.update(repo, self.state.parentctxnode, quietempty=True)
         applychanges(repo.ui, repo, rulectx, {})
+        hint = _(b'to amend %s, `hg histedit --continue` after making changes')
         raise error.InterventionRequired(
-            _(b'Editing (%s), you may commit or record as needed now.')
+            _(b'Editing (%s), commit as needed now to split the change')
             % node.short(self.node),
-            hint=_(b'hg histedit --continue to resume'),
+            hint=hint % node.short(self.node),
         )
 
     def commiteditor(self):