# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1603903285 -3600 # Node ID e0ad11ab80529b702afc901da0c3e5f7bf57df2b # Parent ff48eea4a926fe9745a26c2fa7e06f91b7c82c71 backout: don't assume that tip as what we just committed Differential Revision: https://phab.mercurial-scm.org/D9256 diff -r ff48eea4a926 -r e0ad11ab8052 mercurial/commands.py --- a/mercurial/commands.py Fri Oct 23 20:33:36 2020 +0900 +++ b/mercurial/commands.py Wed Oct 28 17:41:25 2020 +0100 @@ -861,13 +861,11 @@ 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()) - ) + ui.status(_(b'merging with changeset %s\n') % nice(newnode)) overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')} with ui.configoverride(overrides, b'backout'): return hg.merge(repo[b'tip']) diff -r ff48eea4a926 -r e0ad11ab8052 tests/test-backout.t --- a/tests/test-backout.t Fri Oct 23 20:33:36 2020 +0900 +++ b/tests/test-backout.t Wed Oct 28 17:41:25 2020 +0100 @@ -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