diff tests/test-namespaces.t @ 6687:e2fbec28654c mercurial-5.6

test-compat: merge mercurial-5.7 into mercurial-5.6
author Anton Shestakov <av6@dwimlabs.net>
date Sun, 04 Feb 2024 16:54:39 -0300
parents a62308fb15c1 752201811d5a
children 6c653a3160ff 3228f1e92466
line wrap: on
line diff
--- a/tests/test-namespaces.t	Sat Oct 14 13:34:03 2023 -0300
+++ b/tests/test-namespaces.t	Sun Feb 04 16:54:39 2024 -0300
@@ -11,6 +11,8 @@
   marked working directory as topic namespace: space-name
   $ hg debug-topic-namespaces
   space-name
+  $ cat .hg/topic-namespace
+  space-name (no-eol)
 
   $ hg log -r 'wdir()' -T '{topic_namespace}\n'
   none
@@ -31,6 +33,32 @@
   $ hg log -r 'wdir()' -T '{fqbn}\n'
   default//space-name/feature
 
+Non-ascii topic namespace name
+
+  $ hg debug-topic-namespace --clear
+  $ test -f .hg/topic-namespace
+  [1]
+  $ hg --encoding utf-8 debug-topic-namespace æ
+  marked working directory as topic namespace: \xc3\xa6 (esc)
+  $ hg --encoding utf-8 debug-topic-namespaces
+  æ (esc)
+  $ hg --encoding ascii debug-topic-namespaces
+  ? (esc)
+  $ hg --encoding latin1 debug-topic-namespaces
+  \xe6 (esc)
+  $ cat .hg/topic-namespace
+  \xc3\xa6 (no-eol) (esc)
+
+  $ hg --encoding utf-8 debug-topic-namespace ©
+  abort: invalid topic namespace name: '\xc2\xa9' (esc)
+  (topic namespace names can only consist of alphanumeric, '-', '_' and '.' characters)
+  [255]
+
+  $ hg --encoding latin1 debug-topic-namespace æ
+  abort: invalid topic namespace name: '\xc3\xa6' (esc)
+  (topic namespace names can only consist of alphanumeric, '-', '_' and '.' characters)
+  [255]
+
   $ hg branches
 
   $ hg debug-topic-namespace --clear
@@ -63,25 +91,50 @@
   $ hg log -r . -T '{rev}: {fqbn}\n'
   0: stable//alice/feature
 
+  $ hg log -r . -T '{rev}: {join(extras, " ")}\n'
+  0: branch=stable topic=feature topic-namespace=alice
+
   $ hg branches
   stable//alice/feature          0:69c7dbf6acd1
 
+Removing topic namespace file if it contains the default value
+
+The default value changed from b'default' to b'none' in 11.1.0, this is a
+safeguard against accidentally putting the new default tns value into commit
+extras with an old version of topic extension
+
+  $ printf 'none' > .hg/topic-namespace
+  $ test -f .hg/topic-namespace
+  $ hg ci -m ''
+  nothing changed
+  [1]
+  $ test -f .hg/topic-namespace
+  [1]
+
 Updating to a revision with a namespace should activate it
 
   $ hg up null
   0 files updated, 0 files merged, 1 files removed, 0 files unresolved
   $ hg debug-topic-namespace
   none
+  $ test -f .hg/topic-namespace
+  [1]
   $ hg topics
      feature (1 changesets)
+  $ test -f .hg/topic
+  [1]
   $ hg up 0
   switching to topic-namespace alice
   switching to topic feature
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg debug-topic-namespace
   alice
+  $ cat .hg/topic-namespace
+  alice (no-eol)
   $ hg topics
    * feature (1 changesets)
+  $ cat .hg/topic
+  feature (no-eol)
 
 Updating to a topic namespace is not supported