# HG changeset patch # User Martin von Zweigbergk # Date 2020-08-18 22:03:57 # Node ID 6ba7190ff8637a69ea6755d1ecc71a1795e5fc44 # Parent cf21cda4281f984f99be113956bdf1e2a74382df commit: clear mergestate also with --amend (issue6304) The `hg commit --amend` uses the in-memory code, which naturally doesn't touch the merge state (well, it shouldn't anyway; I think I've fixed bugs in that area recently). We therefore need to clear the mergestate after calling `repo.commitctx()` since we expect that from `hg commit --amend`. Differential Revision: https://phab.mercurial-scm.org/D8932 diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -3259,6 +3259,7 @@ def amend(ui, repo, old, extra, pats, op if opts.get(b'secret'): commitphase = phases.secret newid = repo.commitctx(new) + ms.reset() # Reroute the working copy parent to the new changeset repo.setparents(newid, nullid) diff --git a/tests/test-amend.t b/tests/test-amend.t --- a/tests/test-amend.t +++ b/tests/test-amend.t @@ -113,7 +113,6 @@ Nothing changed $ hg ci --amend --config experimental.evolution.allowunstable=True 1 new orphan changesets $ hg resolve -l - R f $ cd .. #endif