hgext3rd/topic/topicmap.py
branchstable
changeset 4459 d46360b8c0dc
parent 4450 9b0cde5efbc9
child 4464 05f8908df4ce
--- a/hgext3rd/topic/topicmap.py	Wed Mar 27 20:52:30 2019 +0800
+++ b/hgext3rd/topic/topicmap.py	Wed Nov 21 12:00:46 2018 +0000
@@ -118,7 +118,21 @@
     class topiccache(_topiccache, branchmap.branchcache):
         pass
     branchmap.branchcache = topiccache
-    extensions.wrapfunction(branchmap, 'updatecache', _wrapupdatebmcache)
+
+    try:
+        # Mercurial 4.9
+        class remotetopiccache(_topiccache, branchmap.remotebranchcache):
+            pass
+        branchmap.remotebranchcache = remotetopiccache
+
+        def _wrapupdatebmcachemethod(orig, self, repo):
+            # pass in the bound method as the original
+            return _wrapupdatebmcache(orig.__get__(self), repo)
+        extensions.wrapfunction(branchmap.BranchMapCache, 'updatecache', _wrapupdatebmcachemethod)
+    except AttributeError:
+        # Mercurial 4.8 and before
+        extensions.wrapfunction(branchmap, 'updatecache', _wrapupdatebmcache)
+
 
 def _wrapupdatebmcache(orig, repo):
     previous = getattr(repo, '_autobranchmaptopic', False)