Patchwork D9256: backout: don't assume that tip as what we just committed

login
register
mail settings
Submitter phabricator
Date Oct. 29, 2020, 1:07 a.m.
Message ID <differential-rev-PHID-DREV-fxpzzwdeg2cl2eozmi2m-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47527/
State Superseded
Headers show

Comments

phabricator - Oct. 29, 2020, 1:07 a.m.
danchr created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REPOSITORY
  rHG Mercurial

BRANCH
  stable

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-backout.t

CHANGE DETAILS




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

Patch

diff --git a/tests/test-backout.t b/tests/test-backout.t
--- a/tests/test-backout.t
+++ b/tests/test-backout.t
@@ -806,3 +806,18 @@ 
   $ hg backout --merge --no-commit 2
   abort: cannot specify both --no-commit and --merge
   [255]
+
+Ensure that backout out the same changeset twice performs correctly:
+
+  $ hg backout 2
+  removing 3
+  changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f
+  $ echo 4 > 4
+  $ hg ci -A -m 4
+  adding 4
+  $ hg up 2
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ hg backout 2
+  removing 3
+  created new head
+  changeset 3:8f188de730d9 backs out changeset 2:cccc23d9d68f
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -861,12 +861,12 @@ 
 
     ui.status(
         _(b'changeset %s backs out changeset %s\n')
-        % (nice(repo.changelog.tip()), nice(node))
+        % (nice(newnode), nice(node))
     )
     if opts.get(b'merge') and op1 != node:
         hg.clean(repo, op1, show_stats=False)
         ui.status(
-            _(b'merging with changeset %s\n') % nice(repo.changelog.tip())
+            _(b'merging with changeset %s\n') % nice(newnode)
         )
         overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
         with ui.configoverride(overrides, b'backout'):