diff 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
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Tue Feb 04 16:22:40 2020 -0800
+++ b/hgext3rd/topic/__init__.py	Wed Feb 19 01:35:23 2020 +0100
@@ -110,6 +110,19 @@
     [experimental]
     topic.allow-publish = no
 
+Server side visibility
+======================
+
+Serving changesets with topics to clients without topic extension can get
+confusing. Such clients will have multiple anonymous heads without a clear way
+to distinguish them. They will also "lose" the canonical heads of the branch.
+
+To avoid this confusion, server can be configured to only serve changesets with
+topics to clients with the topic extension (version 9.3+). This might become
+the default in future::
+
+    [experimental]
+    topic.server-gate-topic-changesets = yes
 """
 
 from __future__ import absolute_import
@@ -155,6 +168,7 @@
     flow,
     randomname,
     revset as topicrevset,
+    server,
     stack,
     topicmap,
 )
@@ -222,6 +236,9 @@
     configitem(b'experimental', b'topic-mode.server',
                default=configitems.dynamicdefault,
     )
+    configitem(b'experimental', b'topic.server-gate-topic-changesets',
+               default=False,
+    )
 
     def extsetup(ui):
         # register config that strictly belong to other code (thg, core, etc)
@@ -364,6 +381,8 @@
     # Wrap changelog.add to drop empty topic
     extensions.wrapfunction(changelog.changelog, 'add', wrapadd)
 
+    server.setupserver(ui)
+
 def reposetup(ui, repo):
     if not isinstance(repo, localrepo.localrepository):
         return # this can be a peer in the ssh case (puzzling)