manifest: avoid intersectfiles for matches > 100 files
Previously we tried to avoid manifest.intersectfiles for exact matches
with less than 100 files. However, when the left side of the "or" is false,
the right side gets evaluated, of course, and the evaluation of "util.all(fn
in self for fn in files)" is both costly in itself, and likely to be true,
causing intersectfiles() to be called after all. Fix this by moving the
check for less than 100 files outside of the "or" expression, thereby also
making it apply for a non-exact matcher, should one be passed in.
--- a/mercurial/manifest.py Thu Mar 19 17:40:19 2015 +0100
+++ b/mercurial/manifest.py Wed Mar 18 15:59:45 2015 -0700
@@ -164,8 +164,8 @@
return self.copy()
files = match.files()
- if ((match.matchfn == match.exact and len(files) < 100) or
- (not match.anypats() and util.all(fn in self for fn in files))):
+ if (len(files) < 100 and (match.matchfn == match.exact or
+ (not match.anypats() and util.all(fn in self for fn in files)))):
return self.intersectfiles(files)
lm = manifestdict('')