Mercurial > evolve
comparison 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 |
comparison
equal
deleted
inserted
replaced
5683:1dece375d2ab | 5684:4de216446c53 |
---|---|
28 class repocls(unfi.__class__): | 28 class repocls(unfi.__class__): |
29 # awful hack to see branch as "branch:topic" | 29 # awful hack to see branch as "branch:topic" |
30 def __getitem__(self, key): | 30 def __getitem__(self, key): |
31 ctx = super(repocls, self).__getitem__(key) | 31 ctx = super(repocls, self).__getitem__(key) |
32 oldbranch = ctx.branch | 32 oldbranch = ctx.branch |
33 oldparents = ctx.parents | |
33 rev = ctx.rev() | 34 rev = ctx.rev() |
34 | 35 |
35 def branch(): | 36 def branch(): |
36 branch = oldbranch() | 37 branch = oldbranch() |
37 if rev in publishedset: | 38 if rev in publishedset: |
39 topic = ctx.topic() | 40 topic = ctx.topic() |
40 if topic: | 41 if topic: |
41 branch = b"%s:%s" % (branch, topic) | 42 branch = b"%s:%s" % (branch, topic) |
42 return branch | 43 return branch |
43 | 44 |
45 def parents(): | |
46 parents = oldparents() | |
47 for p in parents: | |
48 if getattr(p, '_topic_ext_branch_hack', False): | |
49 continue | |
50 pbranch = p.branch | |
51 | |
52 def branch(): | |
53 branch = pbranch() | |
54 if p.rev() in publishedset: | |
55 return branch | |
56 topic = p.topic() | |
57 if topic: | |
58 branch = b"%s:%s" % (branch, topic) | |
59 return branch | |
60 p.branch = branch | |
61 p._topic_ext_branch_hack = True | |
62 return parents | |
63 | |
44 ctx.branch = branch | 64 ctx.branch = branch |
65 ctx.parents = parents | |
45 return ctx | 66 return ctx |
46 | 67 |
47 def revbranchcache(self): | 68 def revbranchcache(self): |
48 rbc = super(repocls, self).revbranchcache() | 69 rbc = super(repocls, self).revbranchcache() |
49 localchangelog = self.changelog | 70 localchangelog = self.changelog |