stablerange: minor method reorders on the main class
We put the public method first for clarify.
--- 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)