changeset 16302:49b54f1ae053 stable

dirstate: normalize case of directory components If we have an existing f/a, and rename f to F, adding F/b should be normalized to f/b.
author Matt Mackall <mpm@selenic.com>
date Wed, 28 Mar 2012 19:24:13 -0500
parents de4cb5c42007
children 7ee8aa662937
files mercurial/dirstate.py
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Wed Mar 28 19:24:11 2012 -0500
+++ b/mercurial/dirstate.py	Wed Mar 28 19:24:13 2012 -0500
@@ -82,6 +82,8 @@
         f = {}
         for name in self._map:
             f[util.normcase(name)] = name
+        for name in self._dirs:
+            f[util.normcase(name)] = name
         f['.'] = '.' # prevents useless util.fspath() invocation
         return f
 
@@ -401,8 +403,16 @@
             if isknown or not os.path.lexists(os.path.join(self._root, path)):
                 folded = path
             else:
-                folded = self._foldmap.setdefault(normed,
-                                util.fspath(normed, self._root))
+                # recursively normalize leading directory components
+                # against dirstate
+                if '/' in normed:
+                    d, f = normed.rsplit('/')
+                    d = self._root + "/" + self._normalize(d, isknown)
+                    folded = d + "/" + util.fspath(f, d)
+                else:
+                    folded = util.fspath(normed, self._root)
+                self._foldmap[normed] = folded
+
         return folded
 
     def normalize(self, path, isknown=False):