# HG changeset patch # User Anton Shestakov # Date 1621837602 -28800 # Node ID 6357551cb66f02be082b53ced69a54925d0eadc2 # Parent 8d36bfe9968a3f8a4f9d5eb096e82ee2f692013c topic: announce ext-topics-publish capability in case of SSH and HTTP too diff -r 8d36bfe9968a -r 6357551cb66f hgext3rd/topic/server.py --- 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): diff -r 8d36bfe9968a -r 6357551cb66f tests/test-extension-isolation.t --- 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 diff -r 8d36bfe9968a -r 6357551cb66f tests/test-topic-flow-publish-bare.t --- 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