D11040: amend: make `hg amend -r` update to the rewritten working copy parent

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Jul 9 20:28:55 UTC 2021


martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  hgext/amend.py
  tests/test-amend-rev.t

CHANGE DETAILS

diff --git a/tests/test-amend-rev.t b/tests/test-amend-rev.t
--- a/tests/test-amend-rev.t
+++ b/tests/test-amend-rev.t
@@ -50,9 +50,9 @@
   $ hg amend -r 'desc("modify a")'
   rebasing 2:42e29cb5ca48 "add b"
   $ hg log -G -T '{rev} {desc}'
-  o  6 add b (known-bad-output !)
+  @  6 add b
   |
-  @  5 modify a (known-bad-output !)
+  o  5 modify a
   |
   o  0 add a
   
@@ -166,9 +166,9 @@
   $ hg continue
   rebasing 1:41c4ea50d4cf "modify a"
   $ hg log -G -T '{rev} {desc}'
-  o  5 modify a (known-bad-output !)
+  @  5 modify a
   |
-  @  4 add a (known-bad-output !)
+  o  4 add a
   
 Target commit has new content
   $ hg cat -r 'desc("add a")' a
@@ -288,11 +288,11 @@
   already rebased 1:41c4ea50d4cf "modify a" as 79b758e3d369
   rebasing 2:43217edd8bde "revert a"
   $ hg log -G -T '{rev} {desc}'
-  o  7 revert a (known-bad-output !)
+  @  7 revert a
   |
   o  6 modify a
   |
-  @  5 add a (known-bad-output !)
+  o  5 add a
   
 Target commit has new content
   $ hg cat -r 'desc("add a")' a
diff --git a/hgext/amend.py b/hgext/amend.py
--- a/hgext/amend.py
+++ b/hgext/amend.py
@@ -220,6 +220,10 @@
         ui, repo, state, rebase, amended_ctx, target_ctx, wc_pctx
     )
 
+    # Check out the new tip commit (typically the successor of the
+    # old working copy parent).
+    merge.clean_update(repo[b'tip'])
+
 
 def _rebase_temp_node(ui, repo, state, rebase, temp_ctx, target_ctx):
     if b'rebased_temp_node' in state:



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


More information about the Mercurial-devel mailing list