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.
--- 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):