Skip to content
Snippets Groups Projects
Commit 6e66033f authored by Durham Goode's avatar Durham Goode
Browse files

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

Before the recent refactor, we would not load the entire map until it was
accessed. As part of the refactor, that got lost and even just trying to load
the dirstate parents would load the whole map. This caused a perf regression
(issue5713) and a regression with static http serving (issue5717).

Making it lazy loaded again fixes both.

Differential Revision: https://phab.mercurial-scm.org/D1253
parent 0217f75b
No related branches found
No related tags found
No related merge requests found
......@@ -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,11 +1197,9 @@
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
......@@ -1206,9 +1200,21 @@
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment