comparison tests/test-namespaces.t @ 6396:e5bd76f95145 mercurial-5.5

test-compat: merge mercurial-5.6 into mercurial-5.5
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 06 Feb 2023 21:38:31 +0400
parents 1328195f76a9
children a62308fb15c1
comparison
equal deleted inserted replaced
6350:0aff320554d2 6396:e5bd76f95145
1 https://www.mercurial-scm.org/wiki/TopicPlan#sub_branches.2C_namespacing_and_representation
2
3 $ . "$TESTDIR/testlib/topic_setup.sh"
4
5 $ hg init repo
6 $ cd repo
7
8 $ hg debug-topic-namespace space-name
9 marked working directory as topic namespace: space-name
10 $ hg debug-topic-namespaces
11 space-name
12
13 $ hg log -r 'wdir()' -T '{topic_namespace}\n'
14 space-name
15
16 $ hg log -r 'wdir()' -T '{fqbn}\n'
17 default//space-name/
18
19 $ hg branches
20
21 $ hg debug-topic-namespace --clear
22 $ hg debug-topic-namespaces
23 default
24
25 $ hg debug-topic-namespace --clear nonsense
26 abort: cannot use --clear when setting a topic namespace
27 [255]
28
29 $ hg branch stable
30 marked working directory as branch stable
31 (branches are permanent and global, did you want a bookmark?)
32 $ hg debug-topic-namespace alice
33 marked working directory as topic namespace: alice
34 $ hg topic feature
35 marked working directory as topic: feature
36 $ echo a > a
37 $ hg ci -qAm a
38
39 $ hg debug-topic-namespaces
40 alice
41
42 $ hg log -r . -T '{rev}: {branch} {topic_namespace} {topic}\n'
43 0: stable alice feature
44
45 $ hg log -r . -T '{rev}: {fqbn}\n'
46 0: stable//alice/feature
47
48 $ hg branches
49 stable//alice/feature 0:69c7dbf6acd1
50
51 Updating to a revision with a namespace should activate it
52
53 $ hg up null
54 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
55 $ hg debug-topic-namespace
56 default
57 $ hg topics
58 feature (1 changesets)
59 $ hg up 0
60 switching to topic-namespace alice
61 switching to topic feature
62 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 $ hg debug-topic-namespace
64 alice
65 $ hg topics
66 * feature (1 changesets)
67
68 Updating to a topic namespace is not supported
69
70 $ hg up alice
71 abort: unknown revision 'alice'!
72 [255]
73
74 Revsets
75
76 $ nslog() {
77 > hg log -T '{rev}: {topic_namespace}\n' -r "$1"
78 > }
79
80 $ nslog 'topicnamespace(:)'
81 0: alice
82 $ nslog 'topicnamespace(all())'
83 0: alice
84 $ nslog 'topicnamespace(topicnamespace("alice"))'
85 0: alice
86 $ nslog 'topicnamespace(wdir())'
87 0: alice
88 $ nslog 'topicnamespace("re:ice$")'
89 0: alice
90 $ nslog 'topicnamespace(nonsense)'
91 abort: unknown revision 'nonsense'!
92 [255]
93
94 $ nslog 'topicnamespace("re:nonsense")'
95 $ nslog 'topicnamespace("literal:nonsense")'
96 abort: topic namespace 'nonsense' does not exist!
97 [255]
98
99 Parsing
100
101 $ hg debug-parse-fqbn foo/bar//user26/feature -T '[{branch}] <{topic_namespace}> ({topic})\n'
102 [foo/bar] <user26> (feature)
103
104 no double slashes means it's a named branch
105 $ hg debug-parse-fqbn foo/bar
106 branch: foo/bar
107 namespace: default
108 topic:
109
110 Formatting
111
112 $ hg debug-format-fqbn -b branch -n namespace -t topic
113 branch//namespace/topic
114
115 $ hg debug-format-fqbn -n namespace
116 //namespace/
117
118 $ hg debug-format-fqbn -b foo/bar -n user26 -t feature
119 foo/bar//user26/feature
120
121 default values
122
123 $ hg debug-format-fqbn -b default -n default -t '' --no-short
124 default//default/
125 $ hg debug-format-fqbn -b default -n default -t '' --short
126 default
127
128 $ hg debug-format-fqbn -b default -n namespace -t '' --no-short
129 default//namespace/
130 $ hg debug-format-fqbn -b default -n namespace -t '' --short
131 default//namespace/
132
133 $ hg debug-format-fqbn -b default -n default -t topic --no-short
134 default//default/topic
135 $ hg debug-format-fqbn -b default -n default -t topic --short
136 default//topic
137
138 $ cd ..