Mercurial > evolve
changeset 3304:d942fc5847f9
stablesort: move parent range computation into its own method
Now that we have running code, we'll need to avoid too deep recursion. We
extract the piece dealing with the parent range before we write more code to
warm it.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 10 Dec 2017 04:48:15 +0100 |
parents | 318c938be80d |
children | a878d9406841 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py Sun Dec 10 03:58:22 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Sun Dec 10 04:48:15 2017 +0100 @@ -376,6 +376,12 @@ relevant_parent = min(p1, p2, key=tiebreaker) return relevant_parent + def _parentrange(self, repo, rangeid): + stable_parent = self._stableparent(repo, rangeid[0]) + stable_parent_depth = self.depthrev(repo, stable_parent) + stable_parent_range = (stable_parent, rangeid[1]) + return stable_parent_depth, stable_parent_range + def _subranges(self, repo, rangeid): headrev, initial_index = rangeid # size 1 range can't be sliced @@ -384,13 +390,12 @@ # find were we need to slice slicepoint = self._slicepoint(repo, rangeid) - stable_parent = self._stableparent(repo, headrev) - stable_parent_depth = self.depthrev(repo, stable_parent) - stable_parent_range = (stable_parent, initial_index) - # top range is always the same, so we can build it early for all top_range = (headrev, slicepoint) + stable_parent_data = self._parentrange(repo, rangeid) + stable_parent_depth, stable_parent_range = stable_parent_data + # now find out about the lower range, if we are lucky there is only # one, otherwise we need to issue multiple one to cover every revision # on the lower set. (and cover them only once).