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

Siddharth Agarwal sid0 at fb.com
Tue May 14 12:34:42 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 89df0d5b2e6ba801db340d0f993ba309e0ccfafe
# Parent  c7b2b674c7b820dda44a09f270c4b67ac514f636
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
@@ -807,8 +807,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