comparison mercurial/merge.py @ 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 c568c187102f
children a8262b7784f9
comparison
equal deleted inserted replaced
32497:9eccd559c592 32498:bd56bea5ecf8
821 if any(wctx.sub(s).dirty() for s in wctx.substate): 821 if any(wctx.sub(s).dirty() for s in wctx.substate):
822 m1['.hgsubstate'] = modifiednodeid 822 m1['.hgsubstate'] = modifiednodeid
823 823
824 # Don't use m2-vs-ma optimization if: 824 # Don't use m2-vs-ma optimization if:
825 # - ma is the same as m1 or m2, which we're just going to diff again later 825 # - ma is the same as m1 or m2, which we're just going to diff again later
826 # - The matcher is set already, so we can't override it
827 # - The caller specifically asks for a full diff, which is useful during bid 826 # - The caller specifically asks for a full diff, which is useful during bid
828 # merge. 827 # merge.
829 if (pa not in ([wctx, p2] + wctx.parents()) and 828 if (pa not in ([wctx, p2] + wctx.parents()) and not forcefulldiff):
830 matcher is None and not forcefulldiff):
831 # Identify which files are relevant to the merge, so we can limit the 829 # Identify which files are relevant to the merge, so we can limit the
832 # total m1-vs-m2 diff to just those files. This has significant 830 # total m1-vs-m2 diff to just those files. This has significant
833 # performance benefits in large repositories. 831 # performance benefits in large repositories.
834 relevantfiles = set(ma.diff(m2).keys()) 832 relevantfiles = set(ma.diff(m2).keys())
835 833
837 for copykey, copyvalue in copy.iteritems(): 835 for copykey, copyvalue in copy.iteritems():
838 if copyvalue in relevantfiles: 836 if copyvalue in relevantfiles:
839 relevantfiles.add(copykey) 837 relevantfiles.add(copykey)
840 for movedirkey in movewithdir.iterkeys(): 838 for movedirkey in movewithdir.iterkeys():
841 relevantfiles.add(movedirkey) 839 relevantfiles.add(movedirkey)
842 matcher = scmutil.matchfiles(repo, relevantfiles) 840 filesmatcher = scmutil.matchfiles(repo, relevantfiles)
841 matcher = matchmod.intersectmatchers(matcher, filesmatcher)
843 842
844 diff = m1.diff(m2, match=matcher) 843 diff = m1.diff(m2, match=matcher)
845 844
846 if matcher is None: 845 if matcher is None:
847 matcher = matchmod.always('', '') 846 matcher = matchmod.always('', '')