D981: dirstate: remove _filefoldmap property cache

durham (Durham Goode) phabricator at mercurial-scm.org
Sat Oct 14 00:55:32 EDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGbfddc3d678ae: dirstate: remove _filefoldmap property cache (authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D981?vs=2511&id=2710

REVISION DETAIL
  https://phab.mercurial-scm.org/D981

AFFECTED FILES
  contrib/perf.py
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -133,10 +133,6 @@
         return self._map
 
     @propertycache
-    def _filefoldmap(self):
-        return self._map.filefoldmap()
-
-    @propertycache
     def _dirfoldmap(self):
         f = {}
         normcase = util.normcase
@@ -380,7 +376,7 @@
         rereads the dirstate. Use localrepo.invalidatedirstate() if you want to
         check whether the dirstate has changed before rereading it.'''
 
-        for a in ("_map", "_filefoldmap", "_dirfoldmap", "_branch",
+        for a in ("_map", "_dirfoldmap", "_branch",
                   "_dirs", "_ignore"):
             if a in self.__dict__:
                 delattr(self, a)
@@ -412,10 +408,10 @@
         if self[f] not in "?r" and "_dirs" in self.__dict__:
             self._dirs.delpath(f)
 
-        if "_filefoldmap" in self.__dict__:
+        if "filefoldmap" in self._map.__dict__:
             normed = util.normcase(f)
-            if normed in self._filefoldmap:
-                del self._filefoldmap[normed]
+            if normed in self._map.filefoldmap:
+                del self._map.filefoldmap[normed]
 
         self._updatedfiles.add(f)
 
@@ -563,18 +559,18 @@
 
     def _normalizefile(self, path, isknown, ignoremissing=False, exists=None):
         normed = util.normcase(path)
-        folded = self._filefoldmap.get(normed, None)
+        folded = self._map.filefoldmap.get(normed, None)
         if folded is None:
             if isknown:
                 folded = path
             else:
                 folded = self._discoverpath(path, normed, ignoremissing, exists,
-                                            self._filefoldmap)
+                                            self._map.filefoldmap)
         return folded
 
     def _normalize(self, path, isknown, ignoremissing=False, exists=None):
         normed = util.normcase(path)
-        folded = self._filefoldmap.get(normed, None)
+        folded = self._map.filefoldmap.get(normed, None)
         if folded is None:
             folded = self._dirfoldmap.get(normed, None)
         if folded is None:
@@ -1270,6 +1266,7 @@
                     otherparent.add(fname)
             return nonnorm, otherparent
 
+    @propertycache
     def filefoldmap(self):
         """Returns a dictionary mapping normalized case paths to their
         non-normalized versions.
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -549,8 +549,8 @@
     dirstate = repo.dirstate
     'a' in dirstate
     def d():
-        dirstate._filefoldmap.get('a')
-        del dirstate._filefoldmap
+        dirstate._map.filefoldmap.get('a')
+        del dirstate._map.filefoldmap
     timer(d)
     fm.end()
 



To: durham, #hg-reviewers, quark, durin42
Cc: mercurial-devel


More information about the Mercurial-devel mailing list