Patchwork D8932: commit: clear mergestate also with --amend (issue6304)

login
register
mail settings
Submitter phabricator
Date Aug. 18, 2020, 10:38 p.m.
Message ID <differential-rev-PHID-DREV-r5xv2q34guyudelkqskf-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/47032/
State Superseded
Headers show

Comments

phabricator - Aug. 18, 2020, 10:38 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/cmdutil.py
  tests/test-amend.t

CHANGE DETAILS




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

Patch

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 @@ 
   $ hg ci --amend --config experimental.evolution.allowunstable=True
   1 new orphan changesets
   $ hg resolve -l
-  R f
   $ cd ..
 #endif
 
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -3259,6 +3259,7 @@ 
         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)