# HG changeset patch # User Durham Goode # Date 1426719585 25200 # Node ID 9e03602cd2d8b98e63344c0d9149d828caa93382 # Parent 216fa1ba999333e86200d2608e3b78670168d516 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. diff -r 216fa1ba9993 -r 9e03602cd2d8 mercurial/manifest.py --- 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('')