changeset 43798:32d11a23c9cf

graft: never set both parents equal in the dirstate (issue6098) 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. Differential Revision: https://phab.mercurial-scm.org/D7549
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 05 Dec 2019 09:39:49 -0800
parents fb07126dadbe
children 5558e3437872
files mercurial/merge.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Thu Dec 05 09:34:43 2019 -0800
+++ b/mercurial/merge.py	Thu Dec 05 09:39:49 2019 -0800
@@ -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)