revsfromcache: update cache for the top slice if possible
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 20:37:27 +0100
changeset 2189 40b0e1dbed90
parent 2188 b8a8b7ee26b7
child 2190 f4cc3cf27a3a
revsfromcache: update cache for the top slice if possible Same logic, we update the cache if have the data.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Wed Mar 22 20:37:03 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Wed Mar 22 20:37:27 2017 +0100
@@ -336,7 +336,11 @@
             # wait for that heavy object to be gone.
             parentsubranges = self.subranges(repo, parentrange)
             slices = parentsubranges[:-1] # pop the top
-            top = stablerange(repo, rangeid[0], globalindex, rangeid._revs[-topsize:])
+            top = stablerange(repo, rangeid[0], globalindex)
+            # if we have an entry for the current range, lets update the cache
+            if rangeid in self._revsinrangecache:
+                parentrevs = self._revsinrangecache[rangeid][-topsize:]
+                self._revsinrangecache[top] = parentrevs
             slices.append(top)
             return slices