changeset 5931:6357551cb66f stable

topic: announce ext-topics-publish capability in case of SSH and HTTP too
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 24 May 2021 14:26:42 +0800
parents 8d36bfe9968a
children fe25ec8f0124
files hgext3rd/topic/server.py tests/test-extension-isolation.t tests/test-topic-flow-publish-bare.t
diffstat 3 files changed, 29 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/topic/server.py	Wed May 19 16:28:47 2021 +0800
+++ b/hgext3rd/topic/server.py	Mon May 24 14:26:42 2021 +0800
@@ -71,6 +71,13 @@
     caps = orig(repo, proto)
     if common.hastopicext(repo) and repo.peer().capable(b'topics'):
         caps.append(b'_exttopics_heads')
+        if repo.ui.configbool(b'phases', b'publish'):
+            mode = b'all'
+        elif repo.ui.configbool(b'experimental', b'topic.publish-bare-branch'):
+            mode = b'auto'
+        else:
+            mode = b'none'
+        caps.append(b'ext-topics-publish=%s' % mode)
     return caps
 
 def setupserver(ui):
--- a/tests/test-extension-isolation.t	Wed May 19 16:28:47 2021 +0800
+++ b/tests/test-extension-isolation.t	Mon May 24 14:26:42 2021 +0800
@@ -132,6 +132,7 @@
   [1]
   $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext'
     _exttopics_heads
+    ext-topics-publish=all
     topics
   $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-no-ext | egrep 'topics|evoext'
   [1]
@@ -145,12 +146,14 @@
     _evoext_getbundle_obscommon
     _evoext_obshashrange_v1
     _exttopics_heads
+    ext-topics-publish=all
     topics
   $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
     _evoext_getbundle_obscommon
     _evoext_obshashrange_v1
   $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-topic | egrep 'topics|evoext'
     _exttopics_heads
+    ext-topics-publish=all
     topics
   $ hg debugcapabilities http://$LOCALIP:$HGPORT/repo-evo | egrep 'topics|evoext'
     _evoext_getbundle_obscommon
--- a/tests/test-topic-flow-publish-bare.t	Wed May 19 16:28:47 2021 +0800
+++ b/tests/test-topic-flow-publish-bare.t	Mon May 24 14:26:42 2021 +0800
@@ -8,6 +8,8 @@
 Also testing auto-publish config option with this publishing mode
 
   $ cat << EOF >> "$HGRCPATH"
+  > [ui]
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
   > [experimental]
   > auto-publish = warn
   > [alias]
@@ -343,12 +345,26 @@
   $ hg up branchA
   2 files updated, 0 files merged, 5 files removed, 0 files unresolved
 
+Making sure the topic-publishing mode is announced as a capability
+
+  $ hg debugcapabilities $TESTTMP/bare-branch-server | grep topics
+    ext-topics-publish=auto
+    topics
+  $ hg debugcapabilities ssh://user@dummy/bare-branch-server | grep topics
+    _exttopics_heads
+    ext-topics-publish=auto
+    topics
+  $ hg serve -R ../bare-branch-server -p $HGPORT -d --pid-file hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+  $ hg debugcapabilities http://localhost:$HGPORT | grep topics
+    _exttopics_heads
+    ext-topics-publish=auto
+    topics
+  $ killdaemons.py
+
 Trying to push changeset without topic (would publish them)
 
   $ mkcommit c_aM0
-  $ hg debugcapabilities $TESTTMP/bare-branch-server | grep topics
-    ext-topics-publish=auto
-    topics
   $ hg push --config experimental.auto-publish=abort -r .
   pushing to $TESTTMP/bare-branch-server
   abort: push would publish 1 changesets