obshashrange: warm cache outside of loops
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 12 May 2017 21:00:39 +0200
changeset 2365 4b8b7fd135eb
parent 2364 9b68e65fad4f
child 2366 2241433a77e5
obshashrange: warm cache outside of loops The performance impact will be lower
hgext3rd/evolve/obsdiscovery.py
--- a/hgext3rd/evolve/obsdiscovery.py	Fri May 12 21:20:02 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Fri May 12 21:00:39 2017 +0200
@@ -242,6 +242,7 @@
         entry = (h, 0)
         addentry(entry)
 
+    local.obsstore.rangeobshashcache.update(local)
     querycount = 0
     ui.progress(_("comparing obsmarker with other"), querycount)
     overflow = []
@@ -343,6 +344,7 @@
     linetemplate = '%12d %12s %12d %12d %12d %12s\n'
     headertemplate = linetemplate.replace('d', 's')
     ui.status(headertemplate % headers)
+    repo.obsstore.rangeobshashcache.update(repo)
     for r in ranges:
         d = (r[0],
              s(cl.node(r[0])),
@@ -357,7 +359,6 @@
     """return the obsolete hash associated to a range"""
     cache = repo.obsstore.rangeobshashcache
     cl = repo.changelog
-    cache.update(repo)
     obshash = cache.get(rangeid)
     if obshash is not None:
         return obshash
@@ -634,6 +635,7 @@
         if maxrev is not None:
             repo.stablerange.warmup(repo, upto=maxrev)
     result = []
+    repo.obsstore.rangeobshashcache.update(repo)
     for r in ranges:
         if r[0] is None:
             result.append(node.wdirid)