comparison hgext3rd/topic/__init__.py @ 5139:19b8ffd23795

topic: option to hide topic changesets to plain client This is the first version of an option that make topic changeset hidden to client without the extension. It might become the default in the future.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 19 Feb 2020 01:35:23 +0100
parents 1fe3f7ffb462
children 7bcda49915e8
comparison
equal deleted inserted replaced
5136:bbf33d5f32ef 5139:19b8ffd23795
108 One can prevent any publishing to happens in a repository using:: 108 One can prevent any publishing to happens in a repository using::
109 109
110 [experimental] 110 [experimental]
111 topic.allow-publish = no 111 topic.allow-publish = no
112 112
113 Server side visibility
114 ======================
115
116 Serving changesets with topics to clients without topic extension can get
117 confusing. Such clients will have multiple anonymous heads without a clear way
118 to distinguish them. They will also "lose" the canonical heads of the branch.
119
120 To avoid this confusion, server can be configured to only serve changesets with
121 topics to clients with the topic extension (version 9.3+). This might become
122 the default in future::
123
124 [experimental]
125 topic.server-gate-topic-changesets = yes
113 """ 126 """
114 127
115 from __future__ import absolute_import 128 from __future__ import absolute_import
116 129
117 import functools 130 import functools
153 destination, 166 destination,
154 discovery, 167 discovery,
155 flow, 168 flow,
156 randomname, 169 randomname,
157 revset as topicrevset, 170 revset as topicrevset,
171 server,
158 stack, 172 stack,
159 topicmap, 173 topicmap,
160 ) 174 )
161 175
162 cmdtable = {} 176 cmdtable = {}
220 default=False, 234 default=False,
221 ) 235 )
222 configitem(b'experimental', b'topic-mode.server', 236 configitem(b'experimental', b'topic-mode.server',
223 default=configitems.dynamicdefault, 237 default=configitems.dynamicdefault,
224 ) 238 )
239 configitem(b'experimental', b'topic.server-gate-topic-changesets',
240 default=False,
241 )
225 242
226 def extsetup(ui): 243 def extsetup(ui):
227 # register config that strictly belong to other code (thg, core, etc) 244 # register config that strictly belong to other code (thg, core, etc)
228 # 245 #
229 # To ensure all config items we used are registered, we register them if 246 # To ensure all config items we used are registered, we register them if
361 templatekw.keywords[b'topicidx'] = topicidxkw 378 templatekw.keywords[b'topicidx'] = topicidxkw
362 # Wrap workingctx extra to return the topic name 379 # Wrap workingctx extra to return the topic name
363 extensions.wrapfunction(context.workingctx, '__init__', wrapinit) 380 extensions.wrapfunction(context.workingctx, '__init__', wrapinit)
364 # Wrap changelog.add to drop empty topic 381 # Wrap changelog.add to drop empty topic
365 extensions.wrapfunction(changelog.changelog, 'add', wrapadd) 382 extensions.wrapfunction(changelog.changelog, 'add', wrapadd)
383
384 server.setupserver(ui)
366 385
367 def reposetup(ui, repo): 386 def reposetup(ui, repo):
368 if not isinstance(repo, localrepo.localrepository): 387 if not isinstance(repo, localrepo.localrepository):
369 return # this can be a peer in the ssh case (puzzling) 388 return # this can be a peer in the ssh case (puzzling)
370 389