# HG changeset patch # User Martin von Zweigbergk # Date 2019-12-05 17:39:49 # Node ID 32d11a23c9cf124c5b7dc722e4c068d15ce8a4ac # Parent fb07126dadbe02a5392288affc52f7ef1ffaff50 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 diff --git a/mercurial/merge.py b/mercurial/merge.py --- a/mercurial/merge.py +++ b/mercurial/merge.py @@ -2626,6 +2626,9 @@ def graft( 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)