diff -r 9eccd559c592 -r bd56bea5ecf8 mercurial/merge.py --- 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)