hgext3rd/serverminitopic.py
changeset 3651 fa15068a9945
parent 3518 d938808e31bc
child 3679 b12c5d107187
--- a/hgext3rd/serverminitopic.py	Fri Apr 06 17:53:41 2018 +0200
+++ b/hgext3rd/serverminitopic.py	Fri Apr 06 23:42:47 2018 +0530
@@ -43,17 +43,14 @@
 
 ### make topic visible though "ctx.branch()"
 
-class topicchangectx(context.changectx):
-    """a sunclass of changectx that add topic to the branch name"""
-
-    def branch(self):
-        branch = super(topicchangectx, self).branch()
-        if hasminitopic(self._repo) and self.phase():
-            topic = self._changeset.extra.get('topic')
-            if topic is not None:
-                topic = encoding.tolocal(topic)
-                branch = '%s:%s' % (branch, topic)
-        return branch
+def topicbranch(orig, self):
+    branch = orig(self)
+    if hasminitopic(self._repo) and self.phase():
+        topic = self._changeset.extra.get('topic')
+        if topic is not None:
+            topic = encoding.tolocal(topic)
+            branch = '%s:%s' % (branch, topic)
+    return branch
 
 ### avoid caching topic data in rev-branch-cache
 
@@ -220,7 +217,7 @@
     assert issubclass(current, new), (current, new, targetclass)
 
 def uisetup(ui):
-    wrapclass(context, 'changectx', topicchangectx)
     wrapclass(branchmap, 'branchcache', _topiccache)
     extensions.wrapfunction(branchmap, 'read', wrapread)
     extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps)
+    extensions.wrapfunction(context.changectx, 'branch', topicbranch)