Patchwork [1,of,4,V2] dirstate.walk: remove subrepo and .hg from results before step 3

login
register
mail settings
Submitter Siddharth Agarwal
Date March 25, 2013, 9:27 p.m.
Message ID <bbb2359ecbd4f129631e.1364246824@sid0x220>
Download mbox | patch
Permalink /patch/1190/
State Accepted
Commit 1c40526da52a3ed35497fa58623dfe76382bd4f1
Headers show

Comments

Siddharth Agarwal - March 25, 2013, 9:27 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1364245959 25200
#      Mon Mar 25 14:12:39 2013 -0700
# Node ID bbb2359ecbd4f129631e1840c1a1ca6ee7650baf
# Parent  d68b6129cbfd9e4fd0e364f9f273788b6320f5fc
dirstate.walk: remove subrepo and .hg from results before step 3

An upcoming patch will speed dirstate.walk up by not querying the results dict
when it is empty. This ensures it is in some common cases.

This should be safe because subrepos and .hg aren't part of the dirstate.

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -695,6 +695,10 @@  class dirstate(object):
                     elif nf in dmap and matchfn(nf):
                         results[nf] = None
 
+        for s in subrepos:
+            del results[s]
+        del results['.hg']
+
         # step 3: report unseen items in the dmap hash
         if not skipstep3 and not exact:
             visit = sorted([f for f in dmap if f not in results and matchfn(f)])
@@ -722,9 +726,6 @@  class dirstate(object):
                 nf = iter(visit).next
                 for st in util.statfiles([join(i) for i in visit]):
                     results[nf()] = st
-        for s in subrepos:
-            del results[s]
-        del results['.hg']
         return results
 
     def status(self, match, subrepos, ignored, clean, unknown):