Mercurial > hg-stable
changeset 6834:cbdfd08eabc9
dirstate.walk: speed up calling match function
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Tue, 22 Jul 2008 13:03:31 -0500 |
parents | 6be5edab824c |
children | c016dc1a8e91 |
files | mercurial/dirstate.py mercurial/match.py |
diffstat | 2 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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