Patchwork D7549: graft: never set both parents equal in the dirstate (issue6098)

login
register
mail settings
Submitter phabricator
Date Dec. 5, 2019, 6:03 p.m.
Message ID <differential-rev-PHID-DREV-xio7ah4soj4f4xxaftfk-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43586/
State Superseded
Headers show

Comments

phabricator - Dec. 5, 2019, 6:03 p.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  merge.graft() can set both parents equal in the dirstate when
  keepparent=True. We don't seem to set that in core, but the evolve
  extension does use it. So I couldn't figure out a way to add a test
  for this patch in core.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2626,6 +2626,9 @@ 
         if keepparent and len(parents) == 2 and base in parents:
             parents.remove(base)
             pother = parents[0].node()
+    # Never set both parents equal to each other
+    if pother == pctx.node():
+        pother = nullid
 
     with repo.dirstate.parentchange():
         repo.setparents(pctx.node(), pother)