subranges: add a utility function to set the cache
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 24 Mar 2017 09:21:05 +0100
changeset 2227 4b621b56e3a1
parent 2226 83e6933ae00e
child 2228 3b18440cca74
subranges: add a utility function to set the cache This is preparing on disk persistence for the value in this cache.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Fri Mar 24 09:18:50 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Fri Mar 24 09:21:05 2017 +0100
@@ -264,7 +264,7 @@
         if cached is not None:
             return cached
         value = self._subranges(repo, rangeid)
-        self._subrangescache[rangeid] = value
+        self._setsub(rangeid, value)
         return value
 
     def revsfromrange(self, repo, rangeid):
@@ -316,6 +316,12 @@
         This mostly exist to help the on disk persistence"""
         return self._subrangescache.get(rev)
 
+    def _setsub(self, rev, value):
+        """utility function used to set the subranges cache
+
+        This mostly exist to help the on disk persistence."""
+        self._subrangescache[rev] = value
+
     def _filestablesortcache(self, sortedrevs, merge):
         if merge not in self._stablesortprepared:
             self._stablesortprepared[merge] = (sortedrevs, len(sortedrevs))