dirstate.walk: fast path none-seen + match-always case for step 3
authorSiddharth Agarwal <sid0@fb.com>
Fri, 22 Mar 2013 17:03:49 -0700
changeset 18815 a18919de61e5
parent 18814 1413ba410244
child 18816 7f7d5f8a8f15
dirstate.walk: fast path none-seen + match-always case for step 3 This case is a common one -- e.g. `hg diff`. For a repository with 170,000 files, this speeds up perfstatus from 0.95 seconds to 0.88.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Fri Mar 22 17:03:00 2013 -0700
+++ b/mercurial/dirstate.py	Fri Mar 22 17:03:49 2013 -0700
@@ -705,7 +705,12 @@
 
         # 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)])
+            if not results and matchalways:
+                visit = dmap.keys()
+            else:
+                visit = [f for f in dmap if f not in results and matchfn(f)]
+            visit.sort()
+
             if unknown:
                 # unknown == True means we walked the full directory tree above.
                 # So if a file is not seen it was either a) not matching matchfn