diff -r a18ca224e812 -r 8a772f0c54d9 hgext3rd/topic/__init__.py --- a/hgext3rd/topic/__init__.py Sat Dec 09 05:05:39 2017 +0100 +++ b/hgext3rd/topic/__init__.py Sat Dec 09 06:13:28 2017 +0100 @@ -199,6 +199,9 @@ configitem('_internal', 'keep-topic', default=False, ) + configitem('experimental', 'topic-mode.server', + default=configitem.dynamicdefault, + ) def extsetup(ui): # register config that strictly belong to other code (thg, core, etc) @@ -223,6 +226,7 @@ return '' return self.extra().get(constants.extrakey, '') context.basectx.topic = _contexttopic + def _contexttopicidx(self): topic = self.topic() if not topic: @@ -421,7 +425,19 @@ origvalidator(tr2) tr.validator = validator - if (repo.ui.configbool('experimental', 'topic.publish-bare-branch') + topicmodeserver = repo.ui.config('experimental', + 'topic-mode.server', 'ignore') + ispush = (desc.startswith('push') or desc.startswith('serve')) + if (topicmodeserver != 'ignore' and ispush): + origvalidator = tr.validator + + def validator(tr2): + repo = reporef() + flow.rejectuntopicedchangeset(repo, tr2) + return origvalidator(tr2) + tr.validator = validator + + elif (repo.ui.configbool('experimental', 'topic.publish-bare-branch') and (desc.startswith('push') or desc.startswith('serve')) ):