Mercurial > evolve
changeset 2182:884f6309eae7
stablerange: minor method reorders on the main class
We put the public method first for clarify.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 22 Mar 2017 19:42:37 +0100 |
parents | eea1fdeb1eb3 |
children | 3c2992afee71 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- 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)