merge: pass wctx to premerge, filemerge
In the in-memory merge branch. we'll need to call a function (``flushall``) on
the wctx inside of _xmerge.
This prepares the way so it can be done without hacks like ``fcd.ctx()``.
Differential Revision: https://phab.mercurial-scm.org/D449
--- a/hgext/largefiles/overrides.py Mon Sep 11 18:07:29 2017 +0200
+++ b/hgext/largefiles/overrides.py Mon Sep 11 13:03:27 2017 -0700
@@ -545,10 +545,10 @@
# Override filemerge to prompt the user about how they wish to merge
# largefiles. This will handle identical edits without prompting the user.
-def overridefilemerge(origfn, premerge, repo, mynode, orig, fcd, fco, fca,
+def overridefilemerge(origfn, premerge, repo, wctx, mynode, orig, fcd, fco, fca,
labels=None):
if not lfutil.isstandin(orig) or fcd.isabsent() or fco.isabsent():
- return origfn(premerge, repo, mynode, orig, fcd, fco, fca,
+ return origfn(premerge, repo, wctx, mynode, orig, fcd, fco, fca,
labels=labels)
ahash = lfutil.readasstandin(fca).lower()
--- a/mercurial/filemerge.py Mon Sep 11 18:07:29 2017 +0200
+++ b/mercurial/filemerge.py Mon Sep 11 13:03:27 2017 -0700
@@ -626,7 +626,7 @@
return b, c
-def _filemerge(premerge, repo, mynode, orig, fcd, fco, fca, labels=None):
+def _filemerge(premerge, repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
"""perform a 3-way merge in the working directory
premerge = whether this is a premerge
@@ -750,11 +750,13 @@
def _workingpath(repo, ctx):
return repo.wjoin(ctx.path())
-def premerge(repo, mynode, orig, fcd, fco, fca, labels=None):
- return _filemerge(True, repo, mynode, orig, fcd, fco, fca, labels=labels)
+def premerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
+ return _filemerge(True, repo, wctx, mynode, orig, fcd, fco, fca,
+ labels=labels)
-def filemerge(repo, mynode, orig, fcd, fco, fca, labels=None):
- return _filemerge(False, repo, mynode, orig, fcd, fco, fca, labels=labels)
+def filemerge(repo, wctx, mynode, orig, fcd, fco, fca, labels=None):
+ return _filemerge(False, repo, wctx, mynode, orig, fcd, fco, fca,
+ labels=labels)
def loadinternalmerge(ui, extname, registrarobj):
"""Load internal merge tool from specified registrarobj
--- a/mercurial/merge.py Mon Sep 11 18:07:29 2017 +0200
+++ b/mercurial/merge.py Mon Sep 11 13:03:27 2017 -0700
@@ -495,12 +495,14 @@
f.close()
else:
wctx[dfile].remove(ignoremissing=True)
- complete, r, deleted = filemerge.premerge(self._repo, self._local,
- lfile, fcd, fco, fca,
+ complete, r, deleted = filemerge.premerge(self._repo, wctx,
+ self._local, lfile, fcd,
+ fco, fca,
labels=self._labels)
else:
- complete, r, deleted = filemerge.filemerge(self._repo, self._local,
- lfile, fcd, fco, fca,
+ complete, r, deleted = filemerge.filemerge(self._repo, wctx,
+ self._local, lfile, fcd,
+ fco, fca,
labels=self._labels)
if r is None:
# no real conflict
--- a/tests/failfilemerge.py Mon Sep 11 18:07:29 2017 +0200
+++ b/tests/failfilemerge.py Mon Sep 11 13:03:27 2017 -0700
@@ -9,7 +9,8 @@
)
def failfilemerge(filemergefn,
- premerge, repo, mynode, orig, fcd, fco, fca, labels=None):
+ premerge, repo, wctx, mynode, orig, fcd, fco, fca,
+ labels=None):
raise error.Abort("^C")
return filemergefn(premerge, repo, mynode, orig, fcd, fco, fca, labels)