# HG changeset patch # User Pierre-Yves David # Date 1490209521 -3600 # Node ID 3c2992afee71a5b16c7d6b027bfa142a9d2e98e0 # Parent 884f6309eae7a96a1a2701ac28700368c9f073e4 stablerange: move revs computation within the main class We still need to compute the revision withing a range when we slice a merge. This is the last large logic that remains in the individual class and we migrate is on the main class. diff -r 884f6309eae7 -r 3c2992afee71 hgext3rd/evolve/stablerange.py --- a/hgext3rd/evolve/stablerange.py Wed Mar 22 19:42:37 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Wed Mar 22 20:05:21 2017 +0100 @@ -211,6 +211,15 @@ self._subrangescache[rangeid] = value return value + def revsfromrange(self, repo, rangeid): + # get all revs under heads in stable order + allrevs = stablesort(repo, [rangeid[0]]) + # takes from index + revs = allrevs[rangeid[1]:] + # sanity checks + assert len(revs) == self.rangelength(repo, rangeid) + return revs + @staticmethod def _depthmerge(cl, rev, p1, p2, stack, cache): # sub method to simplify the main 'depthrev' one @@ -370,10 +379,7 @@ @util.propertycache def _revs(self): - length = self._repo.stablerange.rangelength(self._repo, self) - r = stablesort(self._repo, [self[0]])[self[1]:] - assert len(r) == length, (self[0], self[1], len(r), length) - return r + return self._repo.stablerange.revsfromrange(self._repo, self) @eh.reposetup def setupcache(ui, repo):