# HG changeset patch # User Pierre-Yves David # Date 1512878239 -3600 # Node ID a878d94068417758f4c8dfddd22dc950aec78156 # Parent d942fc5847f972d44fc7623bdee779af450a5547 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. diff -r d942fc5847f9 -r a878d9406841 hgext3rd/evolve/stablerange.py --- 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).