D7547: graft: rename `pctx` argument to `base` since that's what it is

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Dec 5 18:03:48 UTC 2019


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

REVISION SUMMARY
  The new name better matches the docstring. It also frees up `pctx` to
  be used for something else (next patch).

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -2582,7 +2582,7 @@
 
 
 def graft(
-    repo, ctx, pctx, labels=None, keepparent=False, keepconflictparent=False
+    repo, ctx, base, labels=None, keepparent=False, keepconflictparent=False
 ):
     """Do a graft-like merge.
 
@@ -2593,7 +2593,7 @@
     renames/copies appropriately.
 
     ctx - changeset to rebase
-    pctx - merge base, usually ctx.p1()
+    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
@@ -2612,7 +2612,7 @@
         ctx.node(),
         True,
         True,
-        pctx.node(),
+        base.node(),
         mergeancestor=mergeancestor,
         labels=labels,
     )
@@ -2622,15 +2622,15 @@
     else:
         pother = nullid
         parents = ctx.parents()
-        if keepparent and len(parents) == 2 and pctx in parents:
-            parents.remove(pctx)
+        if keepparent and len(parents) == 2 and base in parents:
+            parents.remove(base)
             pother = parents[0].node()
 
     with repo.dirstate.parentchange():
         repo.setparents(repo[b'.'].node(), pother)
         repo.dirstate.write(repo.currenttransaction())
         # fix up dirstate for copies and renames
-        copies.duplicatecopies(repo, repo[None], ctx.rev(), pctx.rev())
+        copies.duplicatecopies(repo, repo[None], ctx.rev(), base.rev())
     return stats
 
 



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


More information about the Mercurial-devel mailing list