changeset 19190:b03952ee634d

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.
author Siddharth Agarwal <sid0@fb.com>
date Mon, 22 Apr 2013 17:11:18 -0700
parents f7eff455da03
children ab9de1e8fc36
files mercurial/dirstate.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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))