144 |
144 |
145 def mighttopic(repo): |
145 def mighttopic(repo): |
146 return hasminitopic(repo) and repo.filtername not in _publiconly |
146 return hasminitopic(repo) and repo.filtername not in _publiconly |
147 |
147 |
148 class _topiccache(branchmap.branchcache): # combine me with branchmap.branchcache |
148 class _topiccache(branchmap.branchcache): # combine me with branchmap.branchcache |
|
149 @classmethod |
|
150 def fromfile(cls, repo): |
|
151 orig = super(_topiccache, cls).fromfile |
|
152 return wrapread(orig, repo) |
149 |
153 |
150 def __init__(self, *args, **kwargs): |
154 def __init__(self, *args, **kwargs): |
151 # super() call may fail otherwise |
155 # super() call may fail otherwise |
152 with oldbranchmap(): |
156 with oldbranchmap(): |
153 super(_topiccache, self).__init__(*args, **kwargs) |
157 super(_topiccache, self).__init__(*args, **kwargs) |
224 current = getattr(container, oldname) |
228 current = getattr(container, oldname) |
225 assert issubclass(current, new), (current, new, targetclass) |
229 assert issubclass(current, new), (current, new, targetclass) |
226 |
230 |
227 def uisetup(ui): |
231 def uisetup(ui): |
228 wrapclass(branchmap, 'branchcache', _topiccache) |
232 wrapclass(branchmap, 'branchcache', _topiccache) |
229 extensions.wrapfunction(branchmap, 'read', wrapread) |
233 try: |
|
234 # Mercurial 4.8 and older |
|
235 extensions.wrapfunction(branchmap, 'read', wrapread) |
|
236 except AttributeError: |
|
237 # Mercurial 4.9; branchcache.fromfile now takes care of this |
|
238 # which is alredy defined on _topiccache |
|
239 pass |
230 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) |
240 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) |
231 extensions.wrapfunction(context.changectx, 'branch', topicbranch) |
241 extensions.wrapfunction(context.changectx, 'branch', topicbranch) |