D8026: graft: let caller pass in overlayworkingctx to merge.graft()
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Wed Jan 29 18:39:12 EST 2020
martinvonz updated this revision to Diff 19690.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8026?vs=19659&id=19690
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8026/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8026
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
@@ -2590,7 +2590,13 @@
def graft(
- repo, ctx, base, labels=None, keepparent=False, keepconflictparent=False
+ repo,
+ ctx,
+ base,
+ labels=None,
+ keepparent=False,
+ keepconflictparent=False,
+ wctx=None,
):
"""Do a graft-like merge.
@@ -2613,7 +2619,7 @@
# to copy commits), and 2) informs update that the incoming changes are
# newer than the destination so it doesn't prompt about "remote changed foo
# which local deleted".
- wctx = repo[None]
+ wctx = wctx or repo[None]
pctx = wctx.p1()
mergeancestor = repo.changelog.isancestor(pctx.node(), ctx.node())
@@ -2625,6 +2631,7 @@
base.node(),
mergeancestor=mergeancestor,
labels=labels,
+ wc=wctx,
)
if keepconflictparent and stats.unresolvedcount:
@@ -2639,11 +2646,16 @@
if pother == pctx.node():
pother = nullid
- with repo.dirstate.parentchange():
- repo.setparents(pctx.node(), pother)
- repo.dirstate.write(repo.currenttransaction())
+ if wctx.isinmemory():
+ wctx.setparents(pctx.node(), pother)
# fix up dirstate for copies and renames
copies.graftcopies(wctx, ctx, base)
+ else:
+ with repo.dirstate.parentchange():
+ repo.setparents(pctx.node(), pother)
+ repo.dirstate.write(repo.currenttransaction())
+ # fix up dirstate for copies and renames
+ copies.graftcopies(wctx, ctx, base)
return stats
To: martinvonz, #hg-reviewers, durin42
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list