Mercurial > evolve
changeset 2135:8f63f4b1c33e
stablerange: add an official warmup function
The function is responsible for making sure we have the necessary data for a
sets of heads. For now this only warm the depth cache. More will follow soon.
Such explicite warmup will be usefull for on disck caching as an early point of
writing will be easier.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Wed, 22 Mar 2017 04:27:42 +0100 |
parents | b86b94434de7 |
children | 086a85c37e9e |
files | hgext3rd/evolve/obsdiscovery.py hgext3rd/evolve/stablerange.py |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/obsdiscovery.py Sun Mar 19 04:47:31 2017 +0100 +++ b/hgext3rd/evolve/obsdiscovery.py Wed Mar 22 04:27:42 2017 +0100 @@ -392,8 +392,7 @@ s = node.short revs = scmutil.revrange(repo, opts['rev']) # prewarm depth cache - for r in repo.revs("::%ld", revs): - repo.stablerange.depthrev(repo, r) + repo.stablerange.warmup(repo, revs) toproceed = [stablerange.stablerange(repo, r, 0, ) for r in revs] ranges = set(toproceed) while toproceed:
--- a/hgext3rd/evolve/stablerange.py Sun Mar 19 04:47:31 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Wed Mar 22 04:27:42 2017 +0100 @@ -138,6 +138,11 @@ self._depthcache = {} self._subrangescache = {} + def warmup(self, repo, heads): + """warm the cache up to 'heads'""" + for r in repo.revs("::%ld", heads): + self.depthrev(repo, r) + def depthrev(self, repo, rev): repo = repo.unfiltered() cl = repo.changelog