dirstate: improve case-folding logic
authorMatt Mackall <mpm@selenic.com>
Thu, 26 Jun 2008 15:55:23 -0500
changeset 6756 d56ceb82cddb
parent 6755 f8299c84b5b6
child 6757 55c71226eceb
dirstate: improve case-folding logic - return normalized form in directory walk - track normalized form in known
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Thu Jun 26 14:35:50 2008 -0500
+++ b/mercurial/dirstate.py	Thu Jun 26 15:55:23 2008 -0500
@@ -560,9 +560,10 @@
                             continue
                 for f, kind, st in entries:
                     np = pconvert(join(nd, f))
+                    nn = self.normalize(np)
                     if np in known:
                         continue
-                    known[np] = 1
+                    known[nn] = 1
                     p = join(top, f)
                     # don't trip over symlinks
                     if kind == stat.S_IFDIR:
@@ -571,12 +572,12 @@
                             if hasattr(match, 'dir'):
                                 match.dir(np)
                         if np in dc and match(np):
-                            add((np, 'm', st))
+                            add((nn, 'm', st))
                     elif imatch(np):
                         if supported(np, st.st_mode):
-                            add((np, 'f', st))
+                            add((nn, 'f', st))
                         elif np in dc:
-                            add((np, 'm', st))
+                            add((nn, 'm', st))
             found.sort()
             return found
 
@@ -584,6 +585,7 @@
         files.sort()
         for ff in files:
             nf = normpath(ff)
+            nn = self.normalize(nf)
             f = _join(ff)
             try:
                 st = lstat(f)
@@ -604,9 +606,9 @@
                     for f, src, st in findfiles(f):
                         yield src, f, st
             else:
-                if nf in known:
+                if nn in known:
                     continue
-                known[nf] = 1
+                known[nn] = 1
                 if match(nf):
                     if supported(ff, st.st_mode, verbose=True):
                         yield 'f', self.normalize(nf), st