[PATCH] fix regression reported in 1286

Petr Kodl petrkodl at gmail.com
Fri Sep 5 10:16:59 CDT 2008


# HG changeset patch
# User Petr Kodl <petrkodl at gmail.com>
# Date 1220627655 14400
# Node ID 0d365d58e33635c5851abc206ad045036d9ad998
# Parent  4e62be0208d3465cf241d8fb6fb7c9ce125a490b
fix regression reported in 1286

diff -r 4e62be0208d3 -r 0d365d58e336 mercurial/dirstate.py
--- a/mercurial/dirstate.py	Fri Sep 05 11:04:36 2008 +0200
+++ b/mercurial/dirstate.py	Fri Sep 05 11:14:15 2008 -0400
@@ -94,7 +94,9 @@
             if self._checkcase:
                 self.normalize = self._normalize
             else:
-                self.normalize = lambda x: x
+                def dummy_normalize(path, use_normpath=False): 
+                    return path
+                self.normalize = dummy_normalize
             return self.normalize
         else:
             raise AttributeError, name
@@ -345,14 +347,20 @@
             del self._map[f]
         except KeyError:
             self._ui.warn(_("not in dirstate: %s\n") % f)
-
-    def _normalize(self, path):
-        norm_path = os.path.normcase(os.path.normpath(path))
-        if norm_path not in self._foldmap:
-            if not os.path.exists(os.path.join(self._root, path)):
-                return path
-            self._foldmap[norm_path] = util.fspath(path, self._root)
-        return self._foldmap[norm_path]
+    
+    def _normalize(self, path, use_normpath=False):
+        norm_path = os.path.normcase(path)
+        fold_path = self._foldmap.get(norm_path,None)
+        if fold_path is None:
+            if use_normpath:
+                fold_path = norm_path
+            else:
+                if not os.path.exists(os.path.join(self._root, path)):
+                    fold_path = path
+                else:
+                    fold_path = util.fspath(path, self._root)
+                    self._foldmap[norm_path] = fold_path
+        return fold_path
 
     def clear(self):
         self._map = {}
@@ -518,7 +526,7 @@
                         and entries[hg][1] == dirkind:
                         continue
             for f, kind, st in entries:
-                nf = normalize(nd and (nd + "/" + f) or f)
+                nf = normalize(nd and (nd + "/" + f) or f, True)
                 if nf not in results:
                     if kind == dirkind:
                         if not ignore(nf):


More information about the Mercurial-devel mailing list