changeset 3207:35c79686a635

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.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 24 Nov 2017 23:46:56 -0500
parents 3ccde4699cf0
children 3b33e00a4868
files hgext3rd/serverminitopic.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)