changeset 34309:440ece43024c

merge: allow a custom working context to be passed to update This will allow anyone to enable the first in-menmory merge milestone by wrapping merge.update in an extension and creating an overlayworkingctx. Differential Revision: https://phab.mercurial-scm.org/D682
author Phil Cohen <phillco@fb.com>
date Thu, 14 Sep 2017 13:14:32 -0700
parents 3704d3f21136
children 575097b4dce0
files mercurial/merge.py
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Wed Jun 14 11:13:57 2017 -0400
+++ b/mercurial/merge.py	Thu Sep 14 13:14:32 2017 -0700
@@ -1479,7 +1479,7 @@
 
 def update(repo, node, branchmerge, force, ancestor=None,
            mergeancestor=False, labels=None, matcher=None, mergeforce=False,
-           updatecheck=None):
+           updatecheck=None, wc=None):
     """
     Perform a merge between the working directory and the given node
 
@@ -1527,6 +1527,9 @@
     2 = abort: uncommitted changes (commit or update --clean to discard changes)
     3 = abort: uncommitted changes (checked in commands.py)
 
+    The merge is performed inside ``wc``, a workingctx-like objects. It defaults
+    to repo[None] if None is passed.
+
     Return the same tuple as applyupdates().
     """
     # Avoid cycle.
@@ -1550,7 +1553,8 @@
     else:
         partial = True
     with repo.wlock():
-        wc = repo[None]
+        if wc is None:
+            wc = repo[None]
         pl = wc.parents()
         p1 = pl[0]
         pas = [None]