changeset 2458:62e4f9ff352b stable

obshashrange: re-warm less revision after reset rewarming every single revision get very expensive quickly. Instead we warm few key revision and rely on the fact this will warm enough useful subrange.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 20 May 2017 03:31:42 +0200
parents 6a23a55f77d2
children 5e6fc802bc8a
files README hgext3rd/evolve/obsdiscovery.py
diffstat 2 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/README	Fri May 19 17:34:45 2017 +0200
+++ b/README	Sat May 20 03:31:42 2017 +0200
@@ -115,8 +115,9 @@
 6.2.1 - in progress
 -------------------
 
-- prune: fix a crash related to color handling,
-- next: fix a crash related to color handling,
+ - prune: fix a crash related to color handling,
+ - next: fix a crash related to color handling,
+ - cache: reduce the warming load in case of reset,
 
 6.2.0 -- 2017-05-18
 -------------------
--- a/hgext3rd/evolve/obsdiscovery.py	Fri May 19 17:34:45 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Sat May 20 03:31:42 2017 +0200
@@ -523,12 +523,17 @@
             con = self._con
             if con is not None:
                 con.execute(_reset)
-            # rewarm the whole cache
+            # rewarm key revisions
+            #
+            # (The current invalidation is too wide, but rewarming every single
+            # revision is quite costly)
+            newrevs = []
             stop = self._cachekey[0] # tiprev
-            if revs:
-                stop = max(revs)
-            if 0 <= stop:
-                revs = repo.changelog.revs(stop=stop)
+            for h in repo.filtered('immutable').changelog.headrevs():
+                if h <= stop:
+                    newrevs.append(h)
+            newrevs.extend(revs)
+            revs = newrevs
 
         # warm the cache for the new revs
         for r in revs: