[PATCH 2 of 3] Eliminate normpath from foldmap calls
Petr Kodl
petrkodl at gmail.com
Tue Sep 30 16:32:21 CDT 2008
# HG changeset patch
# User Petr Kodl <petrkodl at gmail.com>
# Date 1222809788 14400
# Node ID 89c54a451554b0f9475fe08acbf167dbd065212d
# Parent 57241c68b30024f998766a1071e7525a3a8e332f
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.
diff -r 57241c68b300 -r 89c54a451554 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)):
More information about the Mercurial-devel
mailing list