hgext3rd/evolve/utility.py
changeset 3368 7310f3ef6dee
parent 3367 c26dc74b828d
child 3369 c7fbb79cd366
--- a/hgext3rd/evolve/utility.py	Fri Jan 05 04:26:51 2018 +0100
+++ b/hgext3rd/evolve/utility.py	Fri Jan 05 04:26:59 2018 +0100
@@ -39,7 +39,16 @@
 
 def shouldwarmcache(repo, tr):
     configbool = repo.ui.configbool
-    warm = configbool('experimental', 'obshashrange.warm-cache', True)
+    config = repo.ui.config
+    desc = getattr(tr, 'desc', '')
+
+    autocase = tr is None or desc.startswith('push') or desc.startswith('serve')
+    autocache = config('experimental', 'obshashrange.warm-cache',
+                       False) == 'auto'
+    if autocache:
+        warm = autocase
+    else:
+        warm = configbool('experimental', 'obshashrange.warm-cache', True)
 
     if not configbool('experimental', 'obshashrange', False):
         return False