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'): 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