hgext3rd/serverminitopic.py
changeset 4394 c6d1b0a6babe
parent 4364 b74a31c69ad5
child 4521 5303b9128714
--- a/hgext3rd/serverminitopic.py	Wed Jan 30 10:03:00 2019 -0800
+++ b/hgext3rd/serverminitopic.py	Wed Nov 21 12:00:46 2018 +0000
@@ -146,6 +146,10 @@
     return hasminitopic(repo) and repo.filtername not in _publiconly
 
 class _topiccache(branchmap.branchcache): # combine me with branchmap.branchcache
+    @classmethod
+    def fromfile(cls, repo):
+        orig = super(_topiccache, cls).fromfile
+        return wrapread(orig, repo)
 
     def __init__(self, *args, **kwargs):
         # super() call may fail otherwise
@@ -226,6 +230,12 @@
 
 def uisetup(ui):
     wrapclass(branchmap, 'branchcache', _topiccache)
-    extensions.wrapfunction(branchmap, 'read', wrapread)
+    try:
+        # Mercurial 4.8 and older
+        extensions.wrapfunction(branchmap, 'read', wrapread)
+    except AttributeError:
+        # Mercurial 4.9; branchcache.fromfile now takes care of this
+        # which is alredy defined on _topiccache
+        pass
     extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps)
     extensions.wrapfunction(context.changectx, 'branch', topicbranch)