changeset 3536:ece5c53577eb

small refactoring of path normalization in dirstate.statwalk
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Oct 2006 14:10:01 -0500
parents 4d97184a06ad
children 23f7d9621783
files mercurial/dirstate.py
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri Oct 27 14:06:32 2006 -0500
+++ b/mercurial/dirstate.py	Fri Oct 27 14:10:01 2006 -0500
@@ -373,6 +373,7 @@
             files = [self.root]
             dc = self.map.copy()
         else:
+            files = util.unique(files)
             dc = self.filterfiles(files)
 
         def imatch(file_):
@@ -431,12 +432,12 @@
 
         # step one, find all files that match our criteria
         files.sort()
-        for ff in util.unique(files):
+        for ff in files:
+            nf = util.normpath(ff)
             f = self.wjoin(ff)
             try:
                 st = os.lstat(f)
             except OSError, inst:
-                nf = util.normpath(ff)
                 found = False
                 for fn in dc:
                     if nf == fn or (fn.startswith(nf) and fn[len(nf)] == '/'):
@@ -457,14 +458,11 @@
                 for e in sorted_:
                     yield e
             else:
-                ff = util.normpath(ff)
-                if seen(ff):
-                    continue
-                if match(ff):
+                if not seen(nf) and match(nf):
                     if self.supported_type(ff, st, verbose=True):
-                        yield 'f', ff, st
+                        yield 'f', nf, st
                     elif ff in dc:
-                        yield 'm', ff, st
+                        yield 'm', nf, st
 
         # step two run through anything left in the dc hash and yield
         # if we haven't already seen it