changeset 32498:bd56bea5ecf8

merge: use intersectmatchers() in "m2-vs-ma optimization" It doesn't seem like this can actually happen, but seems like cleaner anyway.
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 12 May 2017 16:33:33 -0700
parents 9eccd559c592
children a3583852861a
files mercurial/merge.py
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/merge.py	Fri May 12 23:12:05 2017 -0700
+++ b/mercurial/merge.py	Fri May 12 16:33:33 2017 -0700
@@ -823,11 +823,9 @@
 
     # Don't use m2-vs-ma optimization if:
     # - ma is the same as m1 or m2, which we're just going to diff again later
-    # - The matcher is set already, so we can't override it
     # - The caller specifically asks for a full diff, which is useful during bid
     #   merge.
-    if (pa not in ([wctx, p2] + wctx.parents()) and
-        matcher is None and not forcefulldiff):
+    if (pa not in ([wctx, p2] + wctx.parents()) and not forcefulldiff):
         # Identify which files are relevant to the merge, so we can limit the
         # total m1-vs-m2 diff to just those files. This has significant
         # performance benefits in large repositories.
@@ -839,7 +837,8 @@
                 relevantfiles.add(copykey)
         for movedirkey in movewithdir.iterkeys():
             relevantfiles.add(movedirkey)
-        matcher = scmutil.matchfiles(repo, relevantfiles)
+        filesmatcher = scmutil.matchfiles(repo, relevantfiles)
+        matcher = matchmod.intersectmatchers(matcher, filesmatcher)
 
     diff = m1.diff(m2, match=matcher)