From patchwork Thu Oct 29 01:07:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D9256: backout: don't assume that tip as what we just committed From: phabricator X-Patchwork-Id: 47527 Message-Id: To: Phabricator Cc: mercurial-devel@mercurial-scm.org Date: Thu, 29 Oct 2020 01:07:19 +0000 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 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'):