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.
--- 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