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