# HG changeset patch # User FUJIWARA Katsunori # Date 2011-12-16 12:09:40 # Node ID d6c19cfa03cee4e7c565b53ba832845f2033a415 # Parent 390bcd01775a4438fb2f6385046b866882c179a6 icasefs: avoid normcase()-ing in util.fspath() for efficiency 'dirstate._normalize()', the only caller of 'util.fspath()', has already normcase()-ed path before invocation of it. normcase()-ed root can be cached on dirstate side, too. so, this patch changes 'util.fspath()' API specification to avoid normcase()-ing in it. diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -65,6 +65,10 @@ class dirstate(object): return self._copymap @propertycache + def _normroot(self): + return util.normcase(self._root) + + @propertycache def _foldmap(self): f = {} for name in self._map: @@ -384,7 +388,7 @@ class dirstate(object): folded = path else: folded = self._foldmap.setdefault(normed, - util.fspath(path, self._root)) + util.fspath(normed, self._normroot)) return folded def normalize(self, path, isknown=False): diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -616,10 +616,10 @@ def fspath(name, root): The name is either relative to root, or it is an absolute path starting with root. Note that this function is unnecessary, and should not be called, for case-sensitive filesystems (simply because it's expensive). + + Both name and root should be normcase-ed. ''' # If name is absolute, make it relative - name = normcase(name) - root = normcase(root) if name.startswith(root): l = len(root) if name[l] == os.sep or name[l] == os.altsep: