# HG changeset patch # User Pierre-Yves David # Date 1490350681 -3600 # Node ID e922cd76804a6595e09d38c160743b4ac7858c36 # Parent 6b95bcc402fe49c486f9f8ba7aff8c21555de98d stablerange: warmup all upto a revision Let us start doing more systemic warming of the cache before we start writing things out. This prepare on disk caching. diff -r 6b95bcc402fe -r e922cd76804a hgext3rd/evolve/obsdiscovery.py --- a/hgext3rd/evolve/obsdiscovery.py Fri Mar 24 10:22:38 2017 +0100 +++ b/hgext3rd/evolve/obsdiscovery.py Fri Mar 24 11:18:01 2017 +0100 @@ -398,7 +398,7 @@ s = node.short revs = scmutil.revrange(repo, opts['rev']) # prewarm depth cache - repo.stablerange.warmup(repo, revs) + repo.stablerange.warmup(repo, max(revs)) cl = repo.changelog rangelength = repo.stablerange.rangelength depthrev = repo.stablerange.depthrev diff -r 6b95bcc402fe -r e922cd76804a hgext3rd/evolve/stablerange.py --- a/hgext3rd/evolve/stablerange.py Fri Mar 24 10:22:38 2017 +0100 +++ b/hgext3rd/evolve/stablerange.py Fri Mar 24 11:18:01 2017 +0100 @@ -179,7 +179,7 @@ depth = stablerange.depthrev length = stablerange.rangelength subranges = stablerange.subranges - repo.stablerange.warmup(repo, revs) + repo.stablerange.warmup(repo, max(revs)) if opts['subranges']: ranges = subrangesclosure(repo, revs) else: @@ -245,8 +245,8 @@ # merge. self._inheritancecache = {} - def warmup(self, repo, heads): - """warm the cache up to 'heads'""" + def warmup(self, repo, upto=None): + """warm the cache up""" repo = repo.unfiltered() # subrange should be warmed from head to range to be able to benefit # from revsfromrange cache. otherwise each merge will trigger its own @@ -255,8 +255,12 @@ # we use the revnumber as an approximation for depth ui = repo.ui - revs = repo.revs("::%ld", heads) - nbrevs = len(revs) + if upto: + revs = repo.changelog.revs(stop=upto) + nbrevs = upto + 1 + else: + revs = list(repo.changelog.revs()) + nbrevs = len(repo.changelog) rangeheap = [] for idx, r in enumerate(revs): if not idx % 1000: