# HG changeset patch # User Matt Mackall # Date 1210610228 18000 # Node ID 10c23c1d5f33d09d271cac6aba2c2eff1b7a6f19 # Parent a259e217bc0c1c1196af7f7e5137136bd497a12e walk: use match.dir in statwalk diff -r a259e217bc0c -r 10c23c1d5f33 hgext/purge.py --- a/hgext/purge.py Mon May 12 11:37:08 2008 -0500 +++ b/hgext/purge.py Mon May 12 11:37:08 2008 -0500 @@ -86,11 +86,10 @@ files = [] missing = [] match = cmdutil.match(repo, dirs, opts) + match.dir = directories.append for src, f, st in repo.dirstate.statwalk(match.files(), match, - ignored=ignored, directories=True): - if src == 'd': - directories.append(f) - elif src == 'm': + ignored=ignored): + if src == 'm': missing.append(f) elif src == 'f' and f not in repo.dirstate: files.append(f) diff -r a259e217bc0c -r 10c23c1d5f33 mercurial/dirstate.py --- a/mercurial/dirstate.py Mon May 12 11:37:08 2008 -0500 +++ b/mercurial/dirstate.py Mon May 12 11:37:08 2008 -0500 @@ -422,7 +422,7 @@ yield f def statwalk(self, files, match, unknown=True, - ignored=False, badfn=None, directories=False): + ignored=False, badfn=None): ''' walk recursively through the directory tree, finding all files matched by the match function @@ -430,7 +430,6 @@ results are yielded in a tuple (src, filename, st), where src is one of: 'f' the file was found in the directory tree - 'd' the file is a directory of the tree 'm' the file was only in the dirstate and not in the tree and st is the stat result if the file was found in the directory. @@ -485,8 +484,8 @@ wadd = work.append found = [] add = found.append - if directories: - add((normpath(s[common_prefix_len:]), 'd', lstat(s))) + if hasattr(match, 'dir'): + match.dir(normpath(s[common_prefix_len:])) while work: top = work.pop() entries = listdir(top, stat=True) @@ -513,8 +512,8 @@ if kind == stat.S_IFDIR: if not ignore(np): wadd(p) - if directories: - add((np, 'd', st)) + if hasattr(match, 'dir'): + match.dir(np) if np in dc and match(np): add((np, 'm', st)) elif imatch(np):