D7799: merge: remove unused keepparent argument for graft()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jan 6 19:59:31 EST 2020


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The option was added in d6859d86a5d5 <https://phab.mercurial-scm.org/rHGd6859d86a5d56a245b271574feac1548bb9337ab> (merge.graft: add option to keep
  second parent, 2015-12-03) in order to help fix
  https://bz.mercurial-scm.org/show_bug.cgi?id=4389, but no code was
  ever added to either core or evolve to pass the option. Evolve handles
  at least some kinds of orphan merges these days, so I suspect this
  turned out to not be needed.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/merge.py

CHANGE DETAILS

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2581,21 +2581,17 @@
     return stats
 
 
-def graft(
-    repo, ctx, base, labels=None, keepparent=False, keepconflictparent=False
-):
+def graft(repo, ctx, base, labels=None, keepconflictparent=False):
     """Do a graft-like merge.
 
     This is a merge where the merge ancestor is chosen such that one
     or more changesets are grafted onto the current changeset. In
     addition to the merge, this fixes up the dirstate to include only
-    a single parent (if keepparent is False) and tries to duplicate any
-    renames/copies appropriately.
+    a single parent and tries to duplicate any renames/copies appropriately.
 
     ctx - changeset to rebase
     base - merge base, usually ctx.p1()
     labels - merge labels eg ['local', 'graft']
-    keepparent - keep second parent if any
     keepconflictparent - if unresolved, keep parent used for the merge
 
     """
@@ -2622,10 +2618,6 @@
         pother = ctx.node()
     else:
         pother = nullid
-        parents = ctx.parents()
-        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



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


More information about the Mercurial-devel mailing list