mercurial/merge.py
changeset 27344 43c00ca887d1
parent 27316 777f668eca70
child 27345 98266b1d144d
--- a/mercurial/merge.py	Sat Dec 12 09:57:05 2015 -0800
+++ b/mercurial/merge.py	Mon Dec 14 18:54:03 2015 -0500
@@ -1266,15 +1266,15 @@
         else:
             repo.dirstate.normal(f)
 
-def update(repo, node, branchmerge, force, partial, ancestor=None,
-           mergeancestor=False, labels=None):
+def update(repo, node, branchmerge, force, ancestor=None,
+           mergeancestor=False, labels=None, matcher=None):
     """
     Perform a merge between the working directory and the given node
 
     node = the node to update to, or None if unspecified
     branchmerge = whether to merge between branches
     force = whether to force branch merging or file overwriting
-    partial = a function to filter file lists (dirstate not updated)
+    matcher = a matcher to filter file lists (dirstate not updated)
     mergeancestor = whether it is merging with an ancestor. If true,
       we should accept the incoming changes for any prompts that occur.
       If false, merging with an ancestor (fast-forward) is only allowed
@@ -1313,6 +1313,13 @@
 
     onode = node
     wlock = repo.wlock()
+    # If we're doing a partial update, we need to skip updating
+    # the dirstate, so make a note of any partial-ness to the
+    # update here.
+    if matcher is None or matcher.always():
+        partial = False
+    else:
+        partial = True
     try:
         wc = repo[None]
         pl = wc.parents()
@@ -1407,6 +1414,10 @@
             followcopies = True
 
         ### calculate phase
+        if matcher is None or matcher.always():
+            partial = False
+        else:
+            partial = matcher.matchfn
         actionbyfile, diverge, renamedelete = calculateupdates(
             repo, wc, p2, pas, branchmerge, force, partial, mergeancestor,
             followcopies)
@@ -1516,7 +1527,7 @@
     # which local deleted".
     mergeancestor = repo.changelog.isancestor(repo['.'].node(), ctx.node())
 
-    stats = update(repo, ctx.node(), True, True, False, pctx.node(),
+    stats = update(repo, ctx.node(), True, True, pctx.node(),
                    mergeancestor=mergeancestor, labels=labels)
 
     pother = nullid