[PATCH 2 of 2 V3] dirstate.status: avoid full walks when possible

Siddharth Agarwal sid0 at fb.com
Mon May 13 18:08:04 CDT 2013


# HG changeset patch
# User Siddharth Agarwal <sid0 at fb.com>
# Date 1366751793 25200
#      Tue Apr 23 14:16:33 2013 -0700
# Node ID 4996defd936ac91d468bf8760187cd625f8958d8
# Parent  3fdad8e0543ab0e4f0891f53b0055f409d9ef999
dirstate.status: avoid full walks when possible

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -806,8 +806,13 @@
 
         lnkkind = stat.S_IFLNK
 
-        for fn, st in self.walk(match, subrepos, listunknown,
-                                listignored).iteritems():
+        # We need to do full walks when either
+        # - we're listing all clean files, or
+        # - match.traversedir does something, because match.traversedir should
+        #   be called for every dir in the working dir
+        full = listclean or match.traversedir is not None
+        for fn, st in self.walk(match, subrepos, listunknown, listignored,
+                                full=full).iteritems():
             if fn not in dmap:
                 if (listignored or mexact(fn)) and dirignore(fn):
                     if listignored:


More information about the Mercurial-devel mailing list