changeset 2227:4b621b56e3a1

subranges: 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:21:05 +0100
parents 83e6933ae00e
children 3b18440cca74
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: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))