Mercurial > evolve
comparison hgext3rd/topic/discovery.py @ 2696:a32afe67e8a6
topic: also have the revbranchcache during the discovery
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 02 Jul 2017 16:39:48 +0200 |
parents | b4824e169f18 |
children | bc09dd507c41 |
comparison
equal
deleted
inserted
replaced
2695:b4824e169f18 | 2696:a32afe67e8a6 |
---|---|
33 or bool(remote.listkeys('phases').get('publishing', False))) | 33 or bool(remote.listkeys('phases').get('publishing', False))) |
34 if publishing or not remote.capable('topics'): | 34 if publishing or not remote.capable('topics'): |
35 return orig(*args) | 35 return orig(*args) |
36 | 36 |
37 class repocls(repo.__class__): | 37 class repocls(repo.__class__): |
38 # awful hack to see branch as "branch:topic" | |
38 def __getitem__(self, key): | 39 def __getitem__(self, key): |
39 ctx = super(repocls, self).__getitem__(key) | 40 ctx = super(repocls, self).__getitem__(key) |
40 oldbranch = ctx.branch | 41 oldbranch = ctx.branch |
41 | 42 |
42 def branch(): | 43 def branch(): |
46 branch = "%s:%s" % (branch, topic) | 47 branch = "%s:%s" % (branch, topic) |
47 return branch | 48 return branch |
48 | 49 |
49 ctx.branch = branch | 50 ctx.branch = branch |
50 return ctx | 51 return ctx |
52 | |
53 def revbranchcache(self): | |
54 rbc = super(repocls, self).revbranchcache() | |
55 changelog = self.changelog | |
56 | |
57 def branchinfo(rev): | |
58 branch, close = changelog.branchinfo(rev) | |
59 topic = repo[rev].topic() | |
60 if topic: | |
61 branch = "%s:%s" % (branch, topic) | |
62 return branch, close | |
63 | |
64 rbc.branchinfo = branchinfo | |
65 return rbc | |
51 | 66 |
52 oldrepocls = repo.__class__ | 67 oldrepocls = repo.__class__ |
53 try: | 68 try: |
54 repo.__class__ = repocls | 69 repo.__class__ = repocls |
55 unxx = repo.filtered('unfiltered-topic') | 70 unxx = repo.filtered('unfiltered-topic') |