Mercurial > evolve
comparison hgext3rd/serverminitopic.py @ 4511:e4fc3af2d0a9 mercurial-4.8
test-compat: merge stable into mercurial-4.8
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 11 Apr 2019 22:41:25 +0200 |
parents | c6d1b0a6babe |
children | 5303b9128714 |
comparison
equal
deleted
inserted
replaced
4358:72f4e924f25a | 4511:e4fc3af2d0a9 |
---|---|
1 """enable a minimal verison of topic for server | 1 """enable a minimal verison of topic for server |
2 | |
3 ! This extensions is not actively maintained | |
4 ! We recommand using the main topic extension instead | |
2 | 5 |
3 Non publishing repository will see topic as "branch:topic" in the branch field. | 6 Non publishing repository will see topic as "branch:topic" in the branch field. |
4 | 7 |
5 In addition to adding the extensions, the feature must be manually enabled in the config: | 8 In addition to adding the extensions, the feature must be manually enabled in the config: |
6 | 9 |
141 | 144 |
142 def mighttopic(repo): | 145 def mighttopic(repo): |
143 return hasminitopic(repo) and repo.filtername not in _publiconly | 146 return hasminitopic(repo) and repo.filtername not in _publiconly |
144 | 147 |
145 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) | |
146 | 153 |
147 def __init__(self, *args, **kwargs): | 154 def __init__(self, *args, **kwargs): |
148 # super() call may fail otherwise | 155 # super() call may fail otherwise |
149 with oldbranchmap(): | 156 with oldbranchmap(): |
150 super(_topiccache, self).__init__(*args, **kwargs) | 157 super(_topiccache, self).__init__(*args, **kwargs) |
221 current = getattr(container, oldname) | 228 current = getattr(container, oldname) |
222 assert issubclass(current, new), (current, new, targetclass) | 229 assert issubclass(current, new), (current, new, targetclass) |
223 | 230 |
224 def uisetup(ui): | 231 def uisetup(ui): |
225 wrapclass(branchmap, 'branchcache', _topiccache) | 232 wrapclass(branchmap, 'branchcache', _topiccache) |
226 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 | |
227 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) | 240 extensions.wrapfunction(wireproto, '_capabilities', wireprotocaps) |
228 extensions.wrapfunction(context.changectx, 'branch', topicbranch) | 241 extensions.wrapfunction(context.changectx, 'branch', topicbranch) |