[PATCH 2 of 2] dirstate: normalize on case insensitive filesystems on Mac (issue1663)

Simon Heimberg simohe at besonet.ch
Wed Jul 22 08:22:37 CDT 2009


# HG changeset patch
# User Simon Heimberg <simohe at besonet.ch>
# Date 1248264291 -7200
# Node ID f812e62a12b68c035b1aef3b3732f8486c376373
# Parent  ca876099803a9e71497d9deaee3c9fb7ff47ee81
dirstate: normalize on case insensitive filesystems on Mac (issue1663)

os.path.normcase does not change the path on Mac OS X (uses possix module)

diff -r ca876099803a -r f812e62a12b6 mercurial/dirstate.py
--- a/mercurial/dirstate.py	Mit Jul 22 12:52:02 2009 +0200
+++ b/mercurial/dirstate.py	Mit Jul 22 14:04:51 2009 +0200
@@ -351,8 +351,14 @@
         except KeyError:
             self._ui.warn(_("not in dirstate: %s\n") % f)
 
+    _usenormcase = os.path.normcase("A") == "a"
+
     def _normalize(self, path, knownpath):
-        norm_path = os.path.normcase(path)
+        if self._usenormcase:
+            norm_path = os.path.normcase(path)
+        else:
+            #case insensitive filesystem on Mac OS X
+            norm_path = path.lower()
         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)):


More information about the Mercurial-devel mailing list