Patchwork D1253: dirstate: avoid reading the map when possible (issue5713) (issue5717)

login
register
mail settings
Submitter phabricator
Date Oct. 28, 2017, 8:09 a.m.
Message ID <3d5d2fa32c57fbb155a96d53097d176a@localhost.localdomain>
Download mbox | patch
Permalink /patch/25298/
State Not Applicable
Headers show

Comments

phabricator - Oct. 28, 2017, 8:09 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6e66033f91cc: dirstate: avoid reading the map when possible (issue5713) (issue5717) (authored by durham, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1253?vs=3129&id=3146

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: durham, #hg-reviewers, lothiraldan, yuja
Cc: yuja, lothiraldan, mharbison72, mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -129,7 +129,7 @@ 
     def _map(self):
         '''Return the dirstate contents as a map from filename to
         (state, mode, size, time).'''
-        self._read()
+        self._map = dirstatemap(self._ui, self._opener, self._root)
         return self._map
 
     @property
@@ -353,10 +353,6 @@ 
             f.discard()
             raise
 
-    def _read(self):
-        self._map = dirstatemap(self._ui, self._opener, self._root)
-        self._map.read()
-
     def invalidate(self):
         '''Causes the next access to reread the dirstate.
 
@@ -1201,14 +1197,24 @@ 
         self._root = root
         self._filename = 'dirstate'
 
-        self._map = {}
-        self.copymap = {}
         self._parents = None
         self._dirtyparents = False
 
         # for consistent view between _pl() and _read() invocations
         self._pendingmode = None
 
+    @propertycache
+    def _map(self):
+        self._map = {}
+        self.read()
+        return self._map
+
+    @propertycache
+    def copymap(self):
+        self.copymap = {}
+        self._map
+        return self.copymap
+
     def clear(self):
         self._map = {}
         self.copymap = {}
@@ -1388,7 +1394,7 @@ 
 
     @propertycache
     def identity(self):
-        self.read()
+        self._map
         return self.identity
 
     @propertycache