hgext3rd/topic/__init__.py
changeset 5276 8431bb224862
parent 5203 034d6d0efa7d
parent 5266 af9f40236037
child 5288 5cfec61b872b
--- a/hgext3rd/topic/__init__.py	Sat Mar 21 15:04:18 2020 +0100
+++ b/hgext3rd/topic/__init__.py	Tue Apr 07 19:33:40 2020 +0200
@@ -140,6 +140,7 @@
     commands,
     context,
     error,
+    exchange,
     extensions,
     hg,
     localrepo,
@@ -372,6 +373,8 @@
     extensions.wrapfunction(context.workingctx, '__init__', wrapinit)
     # Wrap changelog.add to drop empty topic
     extensions.wrapfunction(changelog.changelog, 'add', wrapadd)
+    # Make exchange._checkpublish handle experimental.topic.publish-bare-branch
+    extensions.wrapfunction(exchange, '_checkpublish', flow.replacecheckpublish)
 
     server.setupserver(ui)
 
@@ -393,6 +396,9 @@
         def _restrictcapabilities(self, caps):
             caps = super(topicrepo, self)._restrictcapabilities(caps)
             caps.add(b'topics')
+            if self.ui.configbool(b'experimental',
+                                  b'topic.publish-bare-branch'):
+                caps.add(b'ext-topics-publish=auto')
             return caps
 
         def commit(self, *args, **kwargs):