##// END OF EJS Templates
manifestdict: extract condition for _intersectfiles() and use for walk()...
Martin von Zweigbergk -
r24685:b3d78d82 default
parent child Browse files
Show More
@@ -214,6 +214,13 b' class manifestdict(object):'
214 def hasdir(self, dir):
214 def hasdir(self, dir):
215 return dir in self._dirs
215 return dir in self._dirs
216
216
217 def _filesfastpath(self, match):
218 '''Checks whether we can correctly and quickly iterate over matcher
219 files instead of over manifest files.'''
220 files = match.files()
221 return (len(files) < 100 and (match.isexact() or
222 (not match.anypats() and util.all(fn in self for fn in files))))
223
217 def walk(self, match):
224 def walk(self, match):
218 '''Generates matching file names.
225 '''Generates matching file names.
219
226
@@ -230,7 +237,7 b' class manifestdict(object):'
230 fset = set(match.files())
237 fset = set(match.files())
231
238
232 # avoid the entire walk if we're only looking for specific files
239 # avoid the entire walk if we're only looking for specific files
233 if not match.anypats() and util.all(fn in self for fn in fset):
240 if self._filesfastpath(match):
234 for fn in sorted(fset):
241 for fn in sorted(fset):
235 yield fn
242 yield fn
236 return
243 return
@@ -255,9 +262,7 b' class manifestdict(object):'
255 if match.always():
262 if match.always():
256 return self.copy()
263 return self.copy()
257
264
258 files = match.files()
265 if self._filesfastpath(match):
259 if (len(files) < 100 and (match.isexact() or
260 (not match.anypats() and util.all(fn in self for fn in files)))):
261 m = manifestdict()
266 m = manifestdict()
262 lm = self._lm
267 lm = self._lm
263 for fn in match.files():
268 for fn in match.files():
General Comments 0
You need to be logged in to leave comments. Login now