changeset 2225:81f5ebd9e9d0

depth: add a utility function to set the cache This is preparing on disk persistence for the value in this cache.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Fri, 24 Mar 2017 09:15:18 +0100
parents 49776d324d1a
children 83e6933ae00e
files hgext3rd/evolve/stablerange.py
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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))