[PATCH 2 of 3] imported patch eliminate performance regressions on folding filesystems
Petr Kodl
petrkodl at gmail.com
Fri Sep 5 12:31:17 CDT 2008
# HG changeset patch
# User Petr Kodl <petrkodl at gmail.com>
# Date 1220631357 14400
# Node ID 8ff7ab0a0b776e86f2c282d0f7794fe9a6ebe90f
# Parent 64c614951d4652415f8e9cb8791827e19efa6e17
imported patch eliminate performance regressions on folding filesystems
diff -r 64c614951d46 -r 8ff7ab0a0b77 mercurial/dirstate.py
--- a/mercurial/dirstate.py Fri Sep 05 12:15:54 2008 -0400
+++ b/mercurial/dirstate.py Fri Sep 05 12:15:57 2008 -0400
@@ -94,7 +94,9 @@
if self._checkcase:
self.normalize = self._normalize
else:
- self.normalize = lambda x: x
+ def dummy_normalize(path, use_normpath=False):
+ return path
+ self.normalize = dummy_normalize
return self.normalize
else:
raise AttributeError, name
@@ -345,14 +347,20 @@
del self._map[f]
except KeyError:
self._ui.warn(_("not in dirstate: %s\n") % f)
-
- def _normalize(self, path):
- norm_path = os.path.normcase(os.path.normpath(path))
- if norm_path not in self._foldmap:
- if not os.path.exists(os.path.join(self._root, path)):
- return path
- self._foldmap[norm_path] = util.fspath(path, self._root)
- return self._foldmap[norm_path]
+
+ def _normalize(self, path, use_normpath=False):
+ norm_path = os.path.normcase(path)
+ fold_path = self._foldmap.get(norm_path, None)
+ if fold_path is None:
+ if use_normpath:
+ fold_path = norm_path
+ else:
+ if not os.path.exists(os.path.join(self._root, path)):
+ fold_path = path
+ else:
+ fold_path = util.fspath(path, self._root)
+ self._foldmap[norm_path] = fold_path
+ return fold_path
def clear(self):
self._map = {}
@@ -518,7 +526,7 @@
and entries[hg][1] == dirkind:
continue
for f, kind, st in entries:
- nf = normalize(nd and (nd + "/" + f) or f)
+ nf = normalize(nd and (nd + "/" + f) or f, True)
if nf not in results:
if kind == dirkind:
if not ignore(nf):
More information about the Mercurial-devel
mailing list