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

login
register
mail settings
Submitter Siddharth Agarwal
Date May 13, 2013, 11:08 p.m.
Message ID <4996defd936ac91d468b.1368486484@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/1622/
State Superseded
Commit ab9de1e8fc36522bb52a00756a36ff64d74877ff
Headers show

Comments

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

Patch

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: