##// END OF EJS Templates
dirstate.walk: speed up calling match function
Matt Mackall -
r6834:cbdfd08e default
parent child Browse files
Show More
@@ -441,6 +441,7 b' class dirstate(object):'
441 441 ignore = util.never
442 442 dirignore = util.never
443 443
444 matchfn = match.matchfn
444 445 dmap = self._map
445 446 normpath = util.normpath
446 447 normalize = self.normalize
@@ -490,7 +491,7 b' class dirstate(object):'
490 491 if inst.errno != errno.ENOENT:
491 492 fwarn(ff, inst.strerror)
492 493 elif badfn(ff, inst.strerror):
493 if (nf in dmap or not ignore(nf)) and match(nf):
494 if (nf in dmap or not ignore(nf)) and matchfn(nf):
494 495 results[nf] = None
495 496
496 497 # step 2: visit subdirectories
@@ -515,15 +516,15 b' class dirstate(object):'
515 516 if kind == dirkind:
516 517 if not ignore(nf):
517 518 wadd(nf)
518 if nf in dmap and match(nf):
519 if nf in dmap and matchfn(nf):
519 520 results[nf] = None
520 521 elif kind == regkind or kind == lnkkind:
521 522 if nf in dmap:
522 if match(nf):
523 if matchfn(nf):
523 524 results[nf] = st
524 elif match(nf) and not ignore(nf):
525 elif matchfn(nf) and not ignore(nf):
525 526 results[nf] = st
526 elif nf in dmap and match(nf):
527 elif nf in dmap and matchfn(nf):
527 528 results[nf] = None
528 529
529 530 # step 3: report unseen items in the dmap hash
@@ -6,10 +6,10 b' class _match(object):'
6 6 self._cwd = cwd
7 7 self._files = files
8 8 self._fmap = dict.fromkeys(files)
9 self._matchfn = mf
9 self.matchfn = mf
10 10 self._anypats = ap
11 11 def __call__(self, fn):
12 return self._matchfn(fn)
12 return self.matchfn(fn)
13 13 def __iter__(self):
14 14 for f in self._files:
15 15 yield f
General Comments 0
You need to be logged in to leave comments. Login now