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

login
register
mail settings
Submitter phabricator
Date Jan. 7, 2020, 12:59 a.m.
Message ID <differential-rev-PHID-DREV-dq4hxhozg2icd5r6fkdd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/44162/
State Superseded
Headers show

Comments

phabricator - Jan. 7, 2020, 12:59 a.m.
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




To: martinvonz, #hg-reviewers
Cc: mercurial-devel
phabricator - Jan. 9, 2020, 1:58 p.m.
pulkit added a comment.


  > but no code was ever added to either core or evolve to pass the option
  
  It seems like evolve does use this option. https://www.mercurial-scm.org/repo/evolve/file/tip/hgext3rd/evolve/evolvecmd.py#l1104

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7799/new/

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

To: martinvonz, #hg-reviewers
Cc: pulkit, mercurial-devel
phabricator - Jan. 9, 2020, 5:12 p.m.
martinvonz added a comment.


  In D7799#114945 <https://phab.mercurial-scm.org/D7799#114945>, @pulkit wrote:
  
  >> but no code was ever added to either core or evolve to pass the option
  >
  > It seems like evolve does use this option. https://www.mercurial-scm.org/repo/evolve/file/tip/hgext3rd/evolve/evolvecmd.py#l1104
  
  I naively just grepped for "keepparent" and missed that case since it's passing it as a positional argument. Thanks, I'll abandon this patch.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7799/new/

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

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

Patch

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