diff --git a/contrib/perf.py b/contrib/perf.py --- a/contrib/perf.py +++ b/contrib/perf.py @@ -550,8 +550,8 @@ dirstate = repo.dirstate 'a' in dirstate def d(): - dirstate._dirfoldmap.get('a') - del dirstate._dirfoldmap + dirstate._map.dirfoldmap.get('a') + del dirstate._map.dirfoldmap del dirstate._map.dirs timer(d) fm.end() diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py --- a/mercurial/dirstate.py +++ b/mercurial/dirstate.py @@ -132,14 +132,6 @@ self._read() return self._map - @propertycache - def _dirfoldmap(self): - f = {} - normcase = util.normcase - for name in self._map.dirs: - f[normcase(name)] = name - return f - @property def _sparsematcher(self): """The matcher for the sparse checkout. @@ -372,8 +364,7 @@ rereads the dirstate. Use localrepo.invalidatedirstate() if you want to check whether the dirstate has changed before rereading it.''' - for a in ("_map", "_dirfoldmap", "_branch", - "_ignore"): + for a in ("_map", "_branch", "_ignore"): if a in self.__dict__: delattr(self, a) self._lastnormaltime = 0 @@ -568,7 +559,7 @@ normed = util.normcase(path) folded = self._map.filefoldmap.get(normed, None) if folded is None: - folded = self._dirfoldmap.get(normed, None) + folded = self._map.dirfoldmap.get(normed, None) if folded is None: if isknown: folded = path @@ -576,7 +567,7 @@ # store discovered result in dirfoldmap so that future # normalizefile calls don't start matching directories folded = self._discoverpath(path, normed, ignoremissing, exists, - self._dirfoldmap) + self._map.dirfoldmap) return folded def normalize(self, path, isknown=False, ignoremissing=False): @@ -875,7 +866,7 @@ if len(paths) > 1: for path in paths: folded = self._discoverpath(path, norm, True, None, - self._dirfoldmap) + self._map.dirfoldmap) if path != folded: results[path] = None @@ -1396,3 +1387,10 @@ self.read() return self.identity + @propertycache + def dirfoldmap(self): + f = {} + normcase = util.normcase + for name in self.dirs: + f[normcase(name)] = name + return f