Patchwork [06,of,17] merge: use intersectmatchers() in "m2-vs-ma optimization"

login
register
mail settings
Submitter via Mercurial-devel
Date May 25, 2017, 6:24 p.m.
Message ID <64552de63b1b8d509276.1495736687@martinvonz.svl.corp.google.com>
Download mbox | patch
Permalink /patch/20908/
State Accepted
Headers show

Comments

via Mercurial-devel - May 25, 2017, 6:24 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1494632013 25200
#      Fri May 12 16:33:33 2017 -0700
# Node ID 64552de63b1b8d50927699c09c27ab148be4e39a
# Parent  4ca8c5116b65020cce2580a342ebca68b9dea8cc
merge: use intersectmatchers() in "m2-vs-ma optimization"

It doesn't seem like this can actually happen, but seems like cleaner
anyway.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -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)