caches: pass the transaction to the "shouldwarncache" logic
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 05 Jan 2018 03:35:07 +0100
changeset 3366 83b372eceb81
parent 3365 911c91ce686f
child 3367 c26dc74b828d
caches: pass the transaction to the "shouldwarncache" logic This will allow to have smarter mode about cache warming (eg: only warm them for server transaction.
hgext3rd/evolve/depthcache.py
hgext3rd/evolve/firstmergecache.py
hgext3rd/evolve/obsdiscovery.py
hgext3rd/evolve/stablerangecache.py
hgext3rd/evolve/stablesort.py
hgext3rd/evolve/utility.py
--- a/hgext3rd/evolve/depthcache.py	Fri Jan 05 22:17:27 2018 +0100
+++ b/hgext3rd/evolve/depthcache.py	Fri Jan 05 03:35:07 2018 +0100
@@ -78,7 +78,7 @@
         if util.safehasattr(repo, 'updatecaches'):
             @localrepo.unfilteredmethod
             def updatecaches(self, tr=None):
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     self.depthcache.update(self)
                     self.depthcache.save(self)
                 super(depthcacherepo, self).updatecaches(tr)
@@ -96,7 +96,7 @@
                     repo.depthcache.update(repo)
                     repo.depthcache.save(repo)
 
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     tr.addpostclose('warmcache-00depthcache', _warmcache)
                 return tr
 
--- a/hgext3rd/evolve/firstmergecache.py	Fri Jan 05 22:17:27 2018 +0100
+++ b/hgext3rd/evolve/firstmergecache.py	Fri Jan 05 03:35:07 2018 +0100
@@ -40,7 +40,7 @@
         if util.safehasattr(repo, 'updatecaches'):
             @localrepo.unfilteredmethod
             def updatecaches(self, tr=None):
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     self.firstmergecache.update(self)
                     self.firstmergecache.save(self)
                 super(firstmergecacherepo, self).updatecaches(tr)
@@ -58,7 +58,7 @@
                     repo.firstmergecache.update(repo)
                     repo.firstmergecache.save(repo)
 
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     tr.addpostclose('warmcache-01-firstparentcache', _warmcache)
                 return tr
 
--- a/hgext3rd/evolve/obsdiscovery.py	Fri Jan 05 22:17:27 2018 +0100
+++ b/hgext3rd/evolve/obsdiscovery.py	Fri Jan 05 03:35:07 2018 +0100
@@ -598,7 +598,7 @@
         if util.safehasattr(repo, 'updatecaches'):
             @localrepo.unfilteredmethod
             def updatecaches(self, tr=None):
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     self.obsstore.rangeobshashcache.update(self)
                     self.obsstore.rangeobshashcache.save(self)
                 super(obshashrepo, self).updatecaches(tr)
@@ -616,7 +616,7 @@
                     repo.obsstore.rangeobshashcache.update(repo)
                     repo.obsstore.rangeobshashcache.save(repo)
 
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     tr.addpostclose('warmcache-20obshashrange', _warmcache)
                 return tr
 
--- a/hgext3rd/evolve/stablerangecache.py	Fri Jan 05 22:17:27 2018 +0100
+++ b/hgext3rd/evolve/stablerangecache.py	Fri Jan 05 03:35:07 2018 +0100
@@ -358,7 +358,7 @@
         if util.safehasattr(repo, 'updatecaches'):
             @localrepo.unfilteredmethod
             def updatecaches(self, tr=None):
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     self.stablerange.update(self)
                     self.stablerange.save(self)
                 super(stablerangerepo, self).updatecaches(tr)
@@ -376,7 +376,7 @@
                     repo.stablerange.update(repo)
                     repo.stablerange.save(repo)
 
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     tr.addpostclose('warmcache-10stablerange', _warmcache)
                 return tr
 
--- a/hgext3rd/evolve/stablesort.py	Fri Jan 05 22:17:27 2018 +0100
+++ b/hgext3rd/evolve/stablesort.py	Fri Jan 05 03:35:07 2018 +0100
@@ -671,7 +671,7 @@
         if util.safehasattr(repo, 'updatecaches'):
             @localrepo.unfilteredmethod
             def updatecaches(self, tr=None):
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     self.stablesort.update(self)
                     self.stablesort.save(self)
                 super(stablesortrepo, self).updatecaches(tr)
@@ -689,7 +689,7 @@
                     repo.stablesort.update(repo)
                     repo.stablesort.save(repo)
 
-                if utility.shouldwarmcache(self):
+                if utility.shouldwarmcache(self, tr):
                     tr.addpostclose('warmcache-02stablesort', _warmcache)
                 return tr
 
--- a/hgext3rd/evolve/utility.py	Fri Jan 05 22:17:27 2018 +0100
+++ b/hgext3rd/evolve/utility.py	Fri Jan 05 03:35:07 2018 +0100
@@ -37,7 +37,7 @@
     else:
         return parents
 
-def shouldwarmcache(repo):
+def shouldwarmcache(repo, tr):
     configbool = repo.ui.configbool
     if not configbool('experimental', 'obshashrange', False):
         return False