Mercurial > evolve
comparison hgext3rd/serverminitopic.py @ 3651:fa15068a9945
serverminitopic: wrap context.changectx.branch instead of context.changectx
Recently some changes in core resulted in this wrapping of class leading to an
infinite recursion. Let's wrap the particular function instead of wrapping the
whole command.
This fixes test-minitopic.t which was breaking.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Fri, 06 Apr 2018 23:42:47 +0530 |
parents | d938808e31bc |
children | b12c5d107187 |
comparison
equal
deleted
inserted
replaced
3650:35ffd7a4b339 | 3651:fa15068a9945 |
---|---|
41 repo._hasminitopic = enabled | 41 repo._hasminitopic = enabled |
42 return enabled | 42 return enabled |
43 | 43 |
44 ### make topic visible though "ctx.branch()" | 44 ### make topic visible though "ctx.branch()" |
45 | 45 |
46 class topicchangectx(context.changectx): | 46 def topicbranch(orig, self): |
47 """a sunclass of changectx that add topic to the branch name""" | 47 branch = orig(self) |
48 | 48 if hasminitopic(self._repo) and self.phase(): |
49 def branch(self): | 49 topic = self._changeset.extra.get('topic') |
50 branch = super(topicchangectx, self).branch() | 50 if topic is not None: |
51 if hasminitopic(self._repo) and self.phase(): | 51 topic = encoding.tolocal(topic) |
52 topic = self._changeset.extra.get('topic') | 52 branch = '%s:%s' % (branch, topic) |
53 if topic is not None: | 53 return branch |
54 topic = encoding.tolocal(topic) | |
55 branch = '%s:%s' % (branch, topic) | |
56 return branch | |
57 | 54 |
58 ### avoid caching topic data in rev-branch-cache | 55 ### avoid caching topic data in rev-branch-cache |
59 | 56 |
60 class revbranchcacheoverlay(object): | 57 class revbranchcacheoverlay(object): |
61 """revbranch mixin that don't use the cache for non public changeset""" | 58 """revbranch mixin that don't use the cache for non public changeset""" |
218 setattr(container, oldname, targetclass) | 215 setattr(container, oldname, targetclass) |
219 current = getattr(container, oldname) | 216 current = getattr(container, oldname) |
220 assert issubclass(current, new), (current, new, targetclass) | 217 assert issubclass(current, new), (current, new, targetclass) |
221 | 218 |
222 def uisetup(ui): | 219 def uisetup(ui): |
223 wrapclass(context, 'changectx', topicchangectx) | |
224 wrapclass(branchmap, 'branchcache', _topiccache) | 220 wrapclass(branchmap, 'branchcache', _topiccache) |
225 extensions.wrapfunction(branchmap, 'read', wrapread) | 221 extensions.wrapfunction(branchmap, 'read', wrapread) |
226 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) | 222 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) |
223 extensions.wrapfunction(context.changectx, 'branch', topicbranch) |