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.
--- 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