stablerange: use the new cache object in the 'mergepoint' version
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sun, 10 Dec 2017 01:48:32 +0100
changeset 3264 383ec26247b3
parent 3263 07678f7a4481
child 3265 70b5bc95efbe
stablerange: use the new cache object in the 'mergepoint' version Every improvement to the cache should reflect on the stable range from there. Since we no longer use the basic sort function, we can simplify the inheritance by dropping one layer.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Sat Nov 25 18:31:37 2017 -0500
+++ b/hgext3rd/evolve/stablerange.py	Sun Dec 10 01:48:32 2017 +0100
@@ -306,10 +306,17 @@
         headrev, index = rangeid[0], rangeid[1]
         return self.depthrev(repo, headrev) - index
 
-class stablerange_mergepoint(stablerangecached, stablerangedummy_mergepoint):
+class stablerange_mergepoint(stablerangecached, stablerangebasic):
     """Stablerange implementation using 'mergepoint' based sorting
     """
 
+    def __init__(self):
+        self._sortcache = stablesort.stablesortcache()
+        super(stablerange_mergepoint, self).__init__()
+
+    def _sortfunction(self, repo, headrev):
+        return self._sortcache.get(repo, headrev)
+
     def revsfromrange(self, repo, rangeid):
         """return revision contained in a range
 
@@ -317,8 +324,7 @@
         <head>, skipping the <index>th lower revisions.
         """
         limit = self.rangelength(repo, rangeid)
-        return stablesort.stablesort_mergepoint_head_debug(repo, [rangeid[0]],
-                                                           limit=limit)
+        return self._sortcache.get(repo, rangeid[0], limit=limit)
 
 class stablerange(stablerangecached):