hgext3rd/topic/discovery.py
changeset 2696 a32afe67e8a6
parent 2695 b4824e169f18
child 3182 bc09dd507c41
--- a/hgext3rd/topic/discovery.py	Sun Jul 02 16:00:38 2017 +0200
+++ b/hgext3rd/topic/discovery.py	Sun Jul 02 16:39:48 2017 +0200
@@ -35,6 +35,7 @@
         return orig(*args)
 
     class repocls(repo.__class__):
+        # awful hack to see branch as "branch:topic"
         def __getitem__(self, key):
             ctx = super(repocls, self).__getitem__(key)
             oldbranch = ctx.branch
@@ -49,6 +50,20 @@
             ctx.branch = branch
             return ctx
 
+        def revbranchcache(self):
+            rbc = super(repocls, self).revbranchcache()
+            changelog = self.changelog
+
+            def branchinfo(rev):
+                branch, close = changelog.branchinfo(rev)
+                topic = repo[rev].topic()
+                if topic:
+                    branch = "%s:%s" % (branch, topic)
+                return branch, close
+
+            rbc.branchinfo = branchinfo
+            return rbc
+
     oldrepocls = repo.__class__
     try:
         repo.__class__ = repocls