[Updated] D8513: rust-dirstatemap: don't read the dirstate when requesting parents
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Thu May 14 20:39:54 UTC 2020
Closed by commit rHG18e36ff8b414: rust-dirstatemap: don't read the dirstate when requesting parents (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8513?vs=21331&id=21385
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8513/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8513
AFFECTED FILES
mercurial/dirstate.py
CHANGE DETAILS
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1743,10 +1743,23 @@
@propertycache
def _rustmap(self):
- self._rustmap = rustmod.DirstateMap(self._root)
+ """
+ Fills the Dirstatemap when called.
+ Use `self._inner_rustmap` if reading the dirstate is not necessary.
+ """
+ self._rustmap = self._inner_rustmap
self.read()
return self._rustmap
+ @propertycache
+ def _inner_rustmap(self):
+ """
+ Does not fill the Dirstatemap when called. This allows for
+ optimizations where only setting/getting the parents is needed.
+ """
+ self._inner_rustmap = rustmod.DirstateMap(self._root)
+ return self._inner_rustmap
+
@property
def copymap(self):
return self._rustmap.copymap()
@@ -1756,6 +1769,7 @@
def clear(self):
self._rustmap.clear()
+ self._inner_rustmap.clear()
self.setparents(nullid, nullid)
util.clearcachedproperty(self, b"_dirs")
util.clearcachedproperty(self, b"_alldirs")
@@ -1812,7 +1826,7 @@
st = b''
try:
- self._parents = self._rustmap.parents(st)
+ self._parents = self._inner_rustmap.parents(st)
except ValueError:
raise error.Abort(
_(b'working directory state appears damaged!')
To: Alphare, #hg-reviewers, marmoute
Cc: marmoute, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200514/12c4fdad/attachment-0002.html>
More information about the Mercurial-patches
mailing list