diff tests/test-namespaces-exchange.t @ 6548:445240ccb701

topic: add experimental.tns-default-pull-namespaces config option This config option controls what topic namespaces get pulled by default. The current default option is '*', which means all namespaces get pulled.
author Anton Shestakov <av6@dwimlabs.net>
date Thu, 27 Jul 2023 16:39:43 -0300
parents
children 703911d39f7a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-namespaces-exchange.t	Thu Jul 27 16:39:43 2023 -0300
@@ -0,0 +1,154 @@
+Limiting topic namespaces during exchange based on a config option
+
+  $ . "$TESTDIR/testlib/common.sh"
+
+  $ cat >> $HGRCPATH << EOF
+  > [extensions]
+  > topic =
+  > [phases]
+  > publish = no
+  > [ui]
+  > ssh = "$PYTHON" "$RUNTESTDIR/dummyssh"
+  > [devel]
+  > tns-report-transactions = pull
+  > EOF
+
+  $ hg init orig
+
+#testcases local ssh http
+
+#if http
+  $ hg serve -R orig -n test -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+#endif
+
+we advertise the new capability, including during local exchange
+
+#if local
+  $ hg debugcapabilities orig | grep topics
+    ext-topics-publish=none
+    ext-topics-tns-heads
+    topics
+    topics-namespaces
+#endif
+#if ssh
+  $ hg debugcapabilities ssh://user@dummy/orig | grep topics
+    _exttopics_heads
+    ext-topics-publish=none
+    ext-topics-tns-heads
+    topics
+    topics-namespaces
+#endif
+#if http
+  $ hg debugcapabilities http://localhost:$HGPORT/ | grep topics
+    _exttopics_heads
+    ext-topics-publish=none
+    ext-topics-tns-heads
+    topics
+    topics-namespaces
+#endif
+
+#if local
+  $ hg clone orig clone -q
+#endif
+#if ssh
+  $ hg clone ssh://user@dummy/orig clone -q
+#endif
+#if http
+  $ hg clone http://localhost:$HGPORT/ clone -q
+#endif
+
+  $ cd orig
+
+changesets without topic namespace are freely exchanged
+
+  $ echo apple > a
+  $ hg debug-topic-namespace --clear
+  $ hg topic apple
+  marked working directory as topic: apple
+  $ hg ci -qAm apple
+
+  $ hg pull -R ../clone
+  pulling from * (glob)
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  new changesets bf4c1d971543 (1 drafts)
+  (run 'hg update' to get a working copy)
+
+changesets with topic namespaces are only exchanged if configuration allows
+
+  $ echo banana > b
+  $ hg debug-topic-namespace bob
+  marked working directory as topic namespace: bob
+  $ hg topic banana
+  $ hg ci -qAm 'banana'
+
+  $ hg pull -R ../clone --config experimental.tns-default-pull-namespaces=foo
+  pulling from * (glob)
+  searching for changes
+  no changes found
+
+this config option takes a list of values
+
+  $ hg pull -R ../clone --config experimental.tns-default-pull-namespaces=foo,bob
+  pulling from * (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  topic namespaces affected: bob
+  added 1 changesets with 1 changes to 1 files
+  new changesets ed9751f04a18 (1 drafts)
+  (run 'hg update' to get a working copy)
+
+we have a "permit all" config value
+
+  $ echo coconut > c
+  $ hg debug-topic-namespace charlie
+  $ hg topic coconut
+  $ hg ci -qAm 'coconut'
+
+  $ hg pull -R ../clone --config experimental.tns-default-pull-namespaces=*
+  pulling from * (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  topic namespaces affected: charlie
+  added 1 changesets with 1 changes to 1 files
+  new changesets 16d2440597e2 (1 drafts)
+  (run 'hg update' to get a working copy)
+
+testing the default value for this config option at the moment
+
+  $ echo durian > d
+  $ hg debug-topic-namespace dave
+  $ hg topic durian
+  $ hg ci -qAm 'durian'
+
+  $ hg pull -R ../clone
+  pulling from * (glob)
+  searching for changes
+  adding changesets
+  adding manifests
+  adding file changes
+  topic namespaces affected: dave
+  added 1 changesets with 1 changes to 1 files
+  new changesets d5d5dda52b2f (1 drafts)
+  (run 'hg update' to get a working copy)
+
+#if http
+  $ $RUNTESTDIR/killdaemons.py $DAEMON_PIDS
+  $ cat $TESTTMP/errors.log
+#endif
+
+  $ hg branches
+  default//dave/durian           3:d5d5dda52b2f
+  default//charlie/coconut       2:16d2440597e2 (inactive)
+  default//bob/banana            1:ed9751f04a18 (inactive)
+  default//apple                 0:bf4c1d971543 (inactive)
+
+  $ cd ..