Eliminate normpath from foldmap calls.
authorPetr Kodl <petrkodl@gmail.com>
Tue, 30 Sep 2008 17:23:08 -0400
changeset 7069 852f39691a0a
parent 7068 57377fa7eda2
child 7070 2627ef59195d
Eliminate normpath from foldmap calls. Normcase already takes care of upper/lower case and /->\ conversions. What's left for normpath is folding of a/../a sequences but this should be either done consistently on both non-folding and folding code path or not at all, otherwise we are introducing inconsistent behavior between the two that has nothing to do with case folding. Second argument against it - normpath being pure Python function is very slow - as much as 50% of time is spend just inside normpath call on my repository.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Tue Sep 30 17:23:08 2008 -0400
+++ b/mercurial/dirstate.py	Tue Sep 30 17:23:08 2008 -0400
@@ -41,7 +41,7 @@
         elif name == '_foldmap':
             _foldmap = {}
             for name in self._map:
-                norm = os.path.normcase(os.path.normpath(name))
+                norm = os.path.normcase(name)
                 _foldmap[norm] = name
             self._foldmap = _foldmap
             return self._foldmap
@@ -351,7 +351,7 @@
             self._ui.warn(_("not in dirstate: %s\n") % f)
 
     def _normalize(self, path, knownpath=False):
-        norm_path = os.path.normcase(os.path.normpath(path))
+        norm_path = os.path.normcase(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)):