comparison mercurial/context.py @ 21895:5809d62e7106

context: extend efficient manifest filtering to when all paths are files On a repository with over 250,000 files and 700,000 commits, this improves cases like hg status --rev <rev> -- <file> # rev is not . from 2.1 seconds to 1.4 seconds. There is further scope for improvement here: for a single file or a small set of files, it is probably more efficient to use filelog linkrevs when possible. However there will always be cases where that will fail (multiple commits pointing to the same file revision, removed files...), so this is independently useful.
author Siddharth Agarwal <sid0@fb.com>
date Wed, 16 Jul 2014 14:53:03 -0700
parents e6754f5e4cf7
children c8411fb5dfef
comparison
equal deleted inserted replaced
21894:1000348b3aea 21895:5809d62e7106
72 generation. 72 generation.
73 """ 73 """
74 if match.always(): 74 if match.always():
75 return self.manifest().copy() 75 return self.manifest().copy()
76 76
77 if match.matchfn == match.exact: 77 files = match.files()
78 return self.manifest().intersectfiles(match.files()) 78 if (match.matchfn == match.exact or
79 (not match.anypats() and util.all(fn in self for fn in files))):
80 return self.manifest().intersectfiles(files)
79 81
80 mf = self.manifest().copy() 82 mf = self.manifest().copy()
81 for fn in mf.keys(): 83 for fn in mf.keys():
82 if not match(fn): 84 if not match(fn):
83 del mf[fn] 85 del mf[fn]