diff mercurial/dirstate.py @ 18814:1413ba410244

dirstate.walk: fast path match-always case during traversal This case is a common one -- e.g. `hg status`. For a repository with 170,000 files, this speeds up perfstatus --unknown from 2.15 seconds to 2.09.
author Siddharth Agarwal <sid0@fb.com>
date Fri, 22 Mar 2013 17:03:00 -0700
parents 1c40526da52a
children a18919de61e5
line wrap: on
line diff
--- a/mercurial/dirstate.py	Mon Mar 25 14:22:34 2013 -0700
+++ b/mercurial/dirstate.py	Fri Mar 22 17:03:00 2013 -0700
@@ -580,6 +580,7 @@
             dirignore = util.always
 
         matchfn = match.matchfn
+        matchalways = match.always()
         badfn = match.bad
         dmap = self._map
         normpath = util.normpath
@@ -687,15 +688,15 @@
                         if not ignore(nf):
                             match.dir(nf)
                             wadd(nf)
-                        if nf in dmap and matchfn(nf):
+                        if nf in dmap and (matchalways or matchfn(nf)):
                             results[nf] = None
                     elif kind == regkind or kind == lnkkind:
                         if nf in dmap:
-                            if matchfn(nf):
+                            if matchalways or matchfn(nf):
                                 results[nf] = st
-                        elif matchfn(nf) and not ignore(nf):
+                        elif (matchalways or matchfn(nf)) and not ignore(nf):
                             results[nf] = st
-                    elif nf in dmap and matchfn(nf):
+                    elif nf in dmap and (matchalways or matchfn(nf)):
                         results[nf] = None
 
         for s in subrepos: