obshashrangecache: make sure we re-warm the cache after a reset
authorPierre-Yves David <pierre-yves.david@octobus.net>
Thu, 18 May 2017 17:47:59 +0200
changeset 2413 22fb71a2d865
parent 2412 8df32538f662
child 2414 fcf54ec1eaf7
obshashrangecache: make sure we re-warm the cache after a reset This will "mitigate" the effect of dropping existing entries when new markers affect existing range.
README
hgext3rd/evolve/obsdiscovery.py
--- a/README	Thu May 18 17:35:36 2017 +0200
+++ b/README	Thu May 18 17:47:59 2017 +0200
@@ -121,7 +121,7 @@
    markers without changesets
  - obshashrange-cache: update incrementally in the (common) case of a
    transaction not affecting existing range,
- - obshashrange-cache: keep the cache mostly warm after each transaction,
+ - obshashrange-cache: keep the cache warm after each transaction,
  - blackbox: log more information about discovery and cache computation.
 
 6.1.1 - in progress
--- a/hgext3rd/evolve/obsdiscovery.py	Thu May 18 17:35:36 2017 +0200
+++ b/hgext3rd/evolve/obsdiscovery.py	Thu May 18 17:47:59 2017 +0200
@@ -506,13 +506,16 @@
         if affected:
             repo.ui.log('evoext-cache', 'obshashcache reset - '
                         'new markers affect cached ranges\n')
+            # XXX the current reset is too strong we could just drop the affected range
             con = self._con
             if con is not None:
                 con.execute(_reset)
-
-        # XXX the current reset is too strong we could just drop the affected range
-
-        # XXX if we reset, we should warm the cache for existing heads (draft and public)
+            # rewarm the whole cache
+            stop = self._cachekey[0] # tiprev
+            if revs:
+                stop = max(revs)
+            if 0 <= stop:
+                revs = repo.changelog.revs(stop=stop)
 
         # warm the cache for the new revs
         for r in revs: