# HG changeset patch # User Siddharth Agarwal # Date 1366675878 25200 # Node ID b03952ee634de701b54a936830d6cac7ccac7e50 # Parent f7eff455da03f814c13a2dad095b207e1e9ae3d3 dirstate.walk: add a flag to let extensions avoid full walks Consider a hypothetical extension that implements walk in a more efficient manner and skips some known-clean files. However, that can only be done under some situations, such as when clean files are not being asked for and a match.traversedir callback is not set. The full flag lets walk tell these two cases apart. diff -r f7eff455da03 -r b03952ee634d mercurial/dirstate.py --- a/mercurial/dirstate.py Mon May 13 17:47:04 2013 -0500 +++ b/mercurial/dirstate.py Mon Apr 22 17:11:18 2013 -0700 @@ -623,14 +623,20 @@ return results, dirsfound, dirsnotfound - def walk(self, match, subrepos, unknown, ignored): + def walk(self, match, subrepos, unknown, ignored, full=True): ''' Walk recursively through the directory tree, finding all files matched by match. + If full is False, maybe skip some known-clean files. + Return a dict mapping filename to stat-like object (either mercurial.osutil.stat instance or return value of os.stat()). + ''' + # full is a flag that extensions that hook into walk can use -- this + # implementation doesn't use it at all. This satisfies the contract + # because we only guarantee a "maybe". def fwarn(f, msg): self._ui.warn('%s: %s\n' % (self.pathto(f), msg))