changeset 9239:26fa0e31011d

dirstate: fold paths using the just added util.realpath() function. Using the one true canonical path of a directory entry allows equivalent paths to be treated gracefully. Equivalent means, in this case, differing directory entries resulting in the same, unique file system link to a file.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sun, 26 Jul 2009 18:02:06 +0200
parents 40196d036a71
children 5ee916274ce0 f6683a7011e9
files mercurial/dirstate.py tests/test-path-normalization tests/test-path-normalization.hg
diffstat 3 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Sun Jul 26 17:25:08 2009 +0200
+++ b/mercurial/dirstate.py	Sun Jul 26 18:02:06 2009 +0200
@@ -59,7 +59,7 @@
     def _foldmap(self):
         f = {}
         for name in self._map:
-            f[os.path.normcase(name)] = name
+            f[util.realpath(self._join(name))] = name
         return f
 
     @propertycache
@@ -340,7 +340,7 @@
             self._ui.warn(_("not in dirstate: %s\n") % f)
 
     def _normalize(self, path, knownpath):
-        norm_path = os.path.normcase(path)
+        norm_path = util.realpath(self._join(path))
         fold_path = self._foldmap.get(norm_path, None)
         if fold_path is None:
             if knownpath or not os.path.exists(os.path.join(self._root, path)):
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-path-normalization	Sun Jul 26 18:02:06 2009 +0200
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+hg clone --quiet $TESTDIR/test-path-normalization.hg t
+exec hg st -R t
Binary file tests/test-path-normalization.hg has changed