diff hgext3rd/topic/discovery.py @ 5684:4de216446c53

topic: also wrap the `ctx.branch` of parents `hg summary` will do some comparison between the current branch and the parents branch, so we need that covered too.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 23 Dec 2020 13:49:45 +0100
parents 1dece375d2ab
children 885a972d5069
line wrap: on
line diff
--- a/hgext3rd/topic/discovery.py	Wed Dec 23 13:36:02 2020 +0100
+++ b/hgext3rd/topic/discovery.py	Wed Dec 23 13:49:45 2020 +0100
@@ -30,6 +30,7 @@
         def __getitem__(self, key):
             ctx = super(repocls, self).__getitem__(key)
             oldbranch = ctx.branch
+            oldparents = ctx.parents
             rev = ctx.rev()
 
             def branch():
@@ -41,7 +42,27 @@
                     branch = b"%s:%s" % (branch, topic)
                 return branch
 
+            def parents():
+                parents = oldparents()
+                for p in parents:
+                    if getattr(p, '_topic_ext_branch_hack', False):
+                        continue
+                    pbranch = p.branch
+
+                    def branch():
+                        branch = pbranch()
+                        if p.rev() in publishedset:
+                            return branch
+                        topic = p.topic()
+                        if topic:
+                            branch = b"%s:%s" % (branch, topic)
+                        return branch
+                    p.branch = branch
+                    p._topic_ext_branch_hack = True
+                return parents
+
             ctx.branch = branch
+            ctx.parents = parents
             return ctx
 
         def revbranchcache(self):