changeset 6833:6be5edab824c

dirstate.walk: reduce sorting in step 3
author Matt Mackall <mpm@selenic.com>
date Tue, 22 Jul 2008 13:03:29 -0500
parents 643ff33812f8
children cbdfd08eabc9
files mercurial/dirstate.py
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Tue Jul 22 13:03:25 2008 -0500
+++ b/mercurial/dirstate.py	Tue Jul 22 13:03:29 2008 -0500
@@ -527,17 +527,17 @@
                         results[nf] = None
 
         # step 3: report unseen items in the dmap hash
-        for nf in util.sort(dmap):
-            if nf not in results and match(nf):
-                results[nf] = None
-                try:
-                    st = lstat(join(nf))
-                    kind = getkind(st.st_mode)
-                    if kind == regkind or kind == lnkkind:
-                        results[nf] = st
-                except OSError, inst:
-                    if inst.errno not in (errno.ENOENT, errno.ENOTDIR):
-                        raise
+        visit = [f for f in dmap if f not in results and match(f)]
+        for nf in util.sort(visit):
+            results[nf] = None
+            try:
+                st = lstat(join(nf))
+                kind = getkind(st.st_mode)
+                if kind == regkind or kind == lnkkind:
+                    results[nf] = st
+            except OSError, inst:
+                if inst.errno not in (errno.ENOENT, errno.ENOTDIR):
+                    raise
 
         del results['.hg']
         return results