diff hgext3rd/topic/__init__.py @ 5221:af9f40236037 stable

topics: fix auto-publish=abort with servers publishing bare branches Before this change, servers that automatically publish bare branches were detected as "non publishing" and the check for automatic publishing on push assumed nothing was to be published. Now we signal the server-side config to clients via a new capability so that they can adjust their behavior.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 06 Apr 2020 05:05:07 +0200
parents 3ff25aafdb4e
children 8431bb224862 1a81bbc94d45
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py	Sat Mar 21 15:04:18 2020 +0100
+++ b/hgext3rd/topic/__init__.py	Mon Apr 06 05:05:07 2020 +0200
@@ -140,6 +140,7 @@
     commands,
     context,
     error,
+    exchange,
     extensions,
     hg,
     localrepo,
@@ -380,6 +381,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)
 
@@ -401,6 +404,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):