diff mercurial/merge.py @ 27345:98266b1d144d

merge: restate calculateupdates in terms of a matcher Once we get a matcher down into manifestmerge, we can make narrowhg work more easily and potentially let manifest.match().diff() do less work in manifestmerge.
author Augie Fackler <augie@google.com>
date Mon, 14 Dec 2015 20:37:41 -0500
parents 43c00ca887d1
children ba0da4b7397d
line wrap: on
line diff
--- a/mercurial/merge.py	Mon Dec 14 18:54:03 2015 -0500
+++ b/mercurial/merge.py	Mon Dec 14 20:37:41 2015 -0500
@@ -841,9 +841,13 @@
             # remote did change but ended up with same content
             del actions[f] # don't get = keep local deleted
 
-def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force, partial,
-                     acceptremote, followcopies):
+def calculateupdates(repo, wctx, mctx, ancestors, branchmerge, force,
+                     acceptremote, followcopies, matcher=None):
     "Calculate the actions needed to merge mctx into wctx using ancestors"
+    if matcher is None or matcher.always():
+        partial = False
+    else:
+        partial = matcher.matchfn
 
     if len(ancestors) == 1: # default
         actions, diverge, renamedelete = manifestmerge(
@@ -1414,13 +1418,9 @@
             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)
+            repo, wc, p2, pas, branchmerge, force, mergeancestor,
+            followcopies, matcher=matcher)
         # Convert to dictionary-of-lists format
         actions = dict((m, []) for m in 'a am f g cd dc r dm dg m e k'.split())
         for f, (m, args, msg) in actionbyfile.iteritems():