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

login
register
mail settings
Submitter phabricator
Date Jan. 29, 2020, 11:39 p.m.
Message ID <4e1b0795f4df26b3df5282f611973c02@localhost.localdomain>
Download mbox | patch
Permalink /patch/44752/
State Not Applicable
Headers show

Comments

phabricator - Jan. 29, 2020, 11:39 p.m.
martinvonz updated this revision to Diff 19691.

REPOSITORY
  rHG Mercurial

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

BRANCH
  default

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




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

Patch

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