Mercurial > evolve
changeset 2183:3c2992afee71
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.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 22 Mar 2017 20:05:21 +0100 |
parents | 884f6309eae7 |
children | 3ec0be20e365 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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):