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

login
register
mail settings
Submitter Siddharth Agarwal
Date May 14, 2013, 5:34 p.m.
Message ID <89df0d5b2e6ba801db34.1368552882@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1633/
State Accepted
Commit ab9de1e8fc36522bb52a00756a36ff64d74877ff
Headers show

Comments

Siddharth Agarwal - May 14, 2013, 5:34 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@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

Patch

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: