D8027: graft: default `base` argument to common case of `ctx.p1()`

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Thu Jan 30 10:39:44 EST 2020


Closed by commit rHG4b774ce8e778: graft: default `base` argument to common case of `ctx.p1()` (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8027?vs=19691&id=19718

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

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

AFFECTED FILES
  hgext/histedit.py
  mercurial/merge.py
  mercurial/shelve.py

CHANGE DETAILS

diff --git a/mercurial/shelve.py b/mercurial/shelve.py
--- a/mercurial/shelve.py
+++ b/mercurial/shelve.py
@@ -996,7 +996,6 @@
         stats = merge.graft(
             repo,
             shelvectx,
-            shelvectx.p1(),
             labels=[b'shelve', b'working-copy'],
             keepconflictparent=True,
         )
diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -2592,7 +2592,7 @@
 def graft(
     repo,
     ctx,
-    base,
+    base=None,
     labels=None,
     keepparent=False,
     keepconflictparent=False,
@@ -2607,7 +2607,7 @@
     renames/copies appropriately.
 
     ctx - changeset to rebase
-    base - merge base, usually ctx.p1()
+    base - merge base, or ctx.p1() if not specified
     labels - merge labels eg ['local', 'graft']
     keepparent - keep second parent if any
     keepconflictparent - if unresolved, keep parent used for the merge
@@ -2621,6 +2621,7 @@
     # which local deleted".
     wctx = wctx or repo[None]
     pctx = wctx.p1()
+    base = base or ctx.p1()
     mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node())
 
     stats = update(
diff --git a/hgext/histedit.py b/hgext/histedit.py
--- a/hgext/histedit.py
+++ b/hgext/histedit.py
@@ -649,7 +649,7 @@
             repo.ui.setconfig(
                 b'ui', b'forcemerge', opts.get(b'tool', b''), b'histedit'
             )
-            stats = mergemod.graft(repo, ctx, ctx.p1(), [b'local', b'histedit'])
+            stats = mergemod.graft(repo, ctx, labels=[b'local', b'histedit'])
         finally:
             repo.ui.setconfig(b'ui', b'forcemerge', b'', b'histedit')
     return stats



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


More information about the Mercurial-devel mailing list