depth: add a utility function to set the cache
This is preparing on disk persistence for the value in this cache.
--- a/hgext3rd/evolve/stablerange.py Fri Mar 24 09:01:25 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py Fri Mar 24 09:15:18 2017 +0100
@@ -249,7 +249,7 @@
# merge case
revdepth = self._depthmerge(cl, current, p1, p2, stack)
if revdepth is not None:
- self._depthcache[current] = revdepth
+ self._setdepth(current, revdepth)
stack.pop()
# actual_depth = len(list(cl.ancestors([rev], inclusive=True)))
# assert revdepth == actual_depth, (rev, revdepth, actual_depth)
@@ -304,6 +304,12 @@
This mostly exist to help the on disk persistence."""
return self._depthcache.get(rev)
+ def _setdepth(self, rev, value):
+ """utility function used to set the depth cache
+
+ This mostly exist to help the on disk persistence."""
+ self._depthcache[rev] = value
+
def _filestablesortcache(self, sortedrevs, merge):
if merge not in self._stablesortprepared:
self._stablesortprepared[merge] = (sortedrevs, len(sortedrevs))