hgext3rd/topic/__init__.py
changeset 5139 19b8ffd23795
parent 5111 1fe3f7ffb462
child 5142 7bcda49915e8
--- 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)