dirstate.walk: reduce sorting in step 3
authorMatt Mackall <mpm@selenic.com>
Tue, 22 Jul 2008 13:03:29 -0500
changeset 6833 6be5edab824c
parent 6832 643ff33812f8
child 6834 cbdfd08eabc9
dirstate.walk: reduce sorting in step 3
mercurial/dirstate.py
--- 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