# HG changeset patch # User Matt Mackall # Date 1216749811 18000 # Node ID cbdfd08eabc96116d801d0e2e7d1856adfdde911 # Parent 6be5edab824c38352146bc04eaf4919b4e791b80 dirstate.walk: speed up calling match function diff -r 6be5edab824c -r cbdfd08eabc9 mercurial/dirstate.py --- a/mercurial/dirstate.py Tue Jul 22 13:03:29 2008 -0500 +++ b/mercurial/dirstate.py Tue Jul 22 13:03:31 2008 -0500 @@ -441,6 +441,7 @@ ignore = util.never dirignore = util.never + matchfn = match.matchfn dmap = self._map normpath = util.normpath normalize = self.normalize @@ -490,7 +491,7 @@ if inst.errno != errno.ENOENT: fwarn(ff, inst.strerror) elif badfn(ff, inst.strerror): - if (nf in dmap or not ignore(nf)) and match(nf): + if (nf in dmap or not ignore(nf)) and matchfn(nf): results[nf] = None # step 2: visit subdirectories @@ -515,15 +516,15 @@ if kind == dirkind: if not ignore(nf): wadd(nf) - if nf in dmap and match(nf): + if nf in dmap and matchfn(nf): results[nf] = None elif kind == regkind or kind == lnkkind: if nf in dmap: - if match(nf): + if matchfn(nf): results[nf] = st - elif match(nf) and not ignore(nf): + elif matchfn(nf) and not ignore(nf): results[nf] = st - elif nf in dmap and match(nf): + elif nf in dmap and matchfn(nf): results[nf] = None # step 3: report unseen items in the dmap hash diff -r 6be5edab824c -r cbdfd08eabc9 mercurial/match.py --- a/mercurial/match.py Tue Jul 22 13:03:29 2008 -0500 +++ b/mercurial/match.py Tue Jul 22 13:03:31 2008 -0500 @@ -6,10 +6,10 @@ self._cwd = cwd self._files = files self._fmap = dict.fromkeys(files) - self._matchfn = mf + self.matchfn = mf self._anypats = ap def __call__(self, fn): - return self._matchfn(fn) + return self.matchfn(fn) def __iter__(self): for f in self._files: yield f