stablerange: minor method reorders on the main class
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Wed, 22 Mar 2017 19:42:37 +0100
changeset 2182 884f6309eae7
parent 2181 eea1fdeb1eb3
child 2183 3c2992afee71
stablerange: minor method reorders on the main class We put the public method first for clarify.
hgext3rd/evolve/stablerange.py
--- a/hgext3rd/evolve/stablerange.py	Wed Mar 22 19:30:23 2017 +0100
+++ b/hgext3rd/evolve/stablerange.py	Wed Mar 22 19:42:37 2017 +0100
@@ -195,6 +195,22 @@
         # assert revdepth == actual_depth, (rev, revdepth, actual_depth)
         return revdepth
 
+    def rangelength(self, repo, rangeid):
+        headrev, index = rangeid[0], rangeid[1]
+        return self.depthrev(repo, headrev) - index
+
+    def subranges(self, repo, rangeid):
+        cached = self._subrangescache.get(rangeid)
+        if cached is not None:
+            return cached
+        if self.rangelength(repo, rangeid) == 1:
+            value = []
+        else:
+            slicepoint = self._slicepoint(repo, rangeid)
+            value = self._slicesrangeat(repo, rangeid, slicepoint)
+        self._subrangescache[rangeid] = value
+        return value
+
     @staticmethod
     def _depthmerge(cl, rev, p1, p2, stack, cache):
         # sub method to simplify the main 'depthrev' one
@@ -240,22 +256,6 @@
             revdepth += len(cl.findmissingrevs(common=[anc], heads=[rev]))
         return revdepth
 
-    def rangelength(self, repo, rangeid):
-        headrev, index = rangeid[0], rangeid[1]
-        return self.depthrev(repo, headrev) - index
-
-    def subranges(self, repo, rangeid):
-        cached = self._subrangescache.get(rangeid)
-        if cached is not None:
-            return cached
-        if self.rangelength(repo, rangeid) == 1:
-            value = []
-        else:
-            slicepoint = self._slicepoint(repo, rangeid)
-            value = self._slicesrangeat(repo, rangeid, slicepoint)
-        self._subrangescache[rangeid] = value
-        return value
-
     def _slicepoint(self, repo, rangeid):
         rangedepth = self.depthrev(repo, rangeid[0])
         step = _hlp2(rangedepth)