revsfromrange: update cache for parentrange directly in the code
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 20:36:19 +0100
changeset 2187 c583efbaec78
parent 2186 57d58f27ffae
child 2188 b8a8b7ee26b7
revsfromrange: update cache for parentrange directly in the code We update it where it matters if we detect that we have the data.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Wed Mar 22 20:34:07 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Wed Mar 22 20:36:19 2017 +0100
@@ -318,7 +318,12 @@
         rangedepth = self.depthrev(repo, rangeid[0])
         topsize = rangedepth - globalindex
 
-        parentrange = stablerange(repo, p1, rangeid[1], rangeid._revs[:-1])
+        parentrange = stablerange(repo, p1, rangeid[1])
+        # if we have an entry for the current range, lets update the cache
+        if rangeid in self._revsinrangecache:
+            parentrevs = self._revsinrangecache[rangeid][:-1]
+            self._revsinrangecache[parentrange] = parentrevs
+
         if topsize == 1:
             top = stablerange(repo, rangeid[0], globalindex, [rangeid[0]])
             return [parentrange, top]