Patchwork D983: dirstate: move the _dirfoldmap to dirstatemap

login
register
mail settings
Submitter phabricator
Date Oct. 14, 2017, 4:55 a.m.
Message ID <24f099a372039d6f83563e0971b5d774@localhost.localdomain>
Download mbox | patch
Permalink /patch/24867/
State Not Applicable
Headers show

Comments

phabricator - Oct. 14, 2017, 4:55 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGe8a89ed7ce96: dirstate: move the _dirfoldmap to dirstatemap (authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D983?vs=2513&id=2713

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

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

CHANGE DETAILS




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

Patch

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,15 +559,15 @@ 
         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
             else:
                 # 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
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -560,8 +560,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()