[PATCH 2 of 3] dirstate: eliminate regression in folding filesystems / tracker 1286
Petr Kodl
petrkodl at gmail.com
Fri Sep 5 15:24:36 CDT 2008
# HG changeset patch
# User Petr Kodl <petrkodl at gmail.com>
# Date 1220646245 14400
# Node ID d06d4ec75479dc1a065312751f0f3c86e4bac6c4
# Parent 1344bb0a54d56e0b5c8ffe1bba7849b666b097aa
dirstate: eliminate regression in folding filesystems / tracker 1286
diff -r 1344bb0a54d5 -r d06d4ec75479 mercurial/dirstate.py
--- a/mercurial/dirstate.py Fri Sep 05 16:24:04 2008 -0400
+++ b/mercurial/dirstate.py Fri Sep 05 16:24:05 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