serverminitopic: also avoid reading
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 24 Nov 2017 23:46:56 -0500
changeset 3207 35c79686a635
parent 3206 3ccde4699cf0
child 3211 3b33e00a4868
serverminitopic: also avoid reading Avoiding to write cache for filter where topic applies is a good step, but we need to also avoid reading it. Existing branchmap cache might exists before the turned the feature on.
hgext3rd/serverminitopic.py
--- a/hgext3rd/serverminitopic.py	Wed Nov 15 08:00:17 2017 +0100
+++ b/hgext3rd/serverminitopic.py	Fri Nov 24 23:46:56 2017 -0500
@@ -189,6 +189,14 @@
         if mighttopic(repo):
             self.phaseshash = _phaseshash(repo, self.tiprev)
 
+def wrapread(orig, repo):
+    # Avoiding to write cache for filter where topic applies is a good step,
+    # but we need to also avoid reading it. Existing branchmap cache might
+    # exists before the turned the feature on.
+    if mighttopic(repo):
+        return None
+    return orig(repo)
+
 # advertise topic capabilities
 
 def wireprotocaps(orig, repo, proto):
@@ -214,4 +222,5 @@
 def uisetup(ui):
     wrapclass(context, 'changectx', topicchangectx)
     wrapclass(branchmap, 'branchcache', _topiccache)
+    extensions.wrapfunction(branchmap, 'read', wrapread)
     extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps)