Mercurial > evolve
changeset 3305:a878d9406841
stablerange: warn cache for all relevant ancestors range
Warming cache in the right order will prevent recursion to happens and unlock
usage on large repository.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 10 Dec 2017 04:57:19 +0100 |
parents | d942fc5847f9 |
children | b67e0f676a28 |
files | hgext3rd/evolve/stablerange.py |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablerange.py Sun Dec 10 04:48:15 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Sun Dec 10 04:57:19 2017 +0100 @@ -382,6 +382,17 @@ stable_parent_range = (stable_parent, rangeid[1]) return stable_parent_depth, stable_parent_range + def _warmcachefor(self, repo, rangeid, slicepoint): + """warm cache with all the element necessary""" + stack = [] + depth, current = self._parentrange(repo, rangeid) + while current not in self._subrangescache and slicepoint < depth: + stack.append(current) + depth, current = self._parentrange(repo, current) + while stack: + current = stack.pop() + self.subranges(repo, current) + def _subranges(self, repo, rangeid): headrev, initial_index = rangeid # size 1 range can't be sliced @@ -390,12 +401,14 @@ # find were we need to slice slicepoint = self._slicepoint(repo, rangeid) - # top range is always the same, so we can build it early for all - top_range = (headrev, slicepoint) + self._warmcachefor(repo, rangeid, slicepoint) stable_parent_data = self._parentrange(repo, rangeid) stable_parent_depth, stable_parent_range = stable_parent_data + # top range is always the same, so we can build it early for all + top_range = (headrev, slicepoint) + # 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).