1 $ . "$TESTDIR/testlib/topic_setup.sh" |
|
2 |
|
3 Initial setup |
|
4 |
|
5 |
|
6 $ cat << EOF >> $HGRCPATH |
|
7 > [extensions] |
|
8 > color = |
|
9 > [ui] |
|
10 > logtemplate = {rev} {branch} \{{get(namespaces, "topics")}} {phase} {desc|firstline}\n |
|
11 > [experimental] |
|
12 > evolution=createmarkers,exchange,allowunstable |
|
13 > EOF |
|
14 |
|
15 $ hg init main |
|
16 $ cd main |
|
17 $ hg topic other |
|
18 $ echo aaa > aaa |
|
19 $ hg add aaa |
|
20 $ hg commit -m c_a |
|
21 $ echo aaa > bbb |
|
22 $ hg add bbb |
|
23 $ hg commit -m c_b |
|
24 $ hg topic foo |
|
25 $ echo aaa > ccc |
|
26 $ hg add ccc |
|
27 $ hg commit -m c_c |
|
28 $ echo aaa > ddd |
|
29 $ hg add ddd |
|
30 $ hg commit -m c_d |
|
31 $ echo aaa > eee |
|
32 $ hg add eee |
|
33 $ hg commit -m c_e |
|
34 $ echo aaa > fff |
|
35 $ hg add fff |
|
36 $ hg commit -m c_f |
|
37 $ hg log -G |
|
38 @ 5 default {foo} draft c_f |
|
39 | |
|
40 o 4 default {foo} draft c_e |
|
41 | |
|
42 o 3 default {foo} draft c_d |
|
43 | |
|
44 o 2 default {foo} draft c_c |
|
45 | |
|
46 o 1 default {other} draft c_b |
|
47 | |
|
48 o 0 default {other} draft c_a |
|
49 |
|
50 |
|
51 Check that topic without any parent does not crash --list |
|
52 --------------------------------------------------------- |
|
53 |
|
54 $ hg up other |
|
55 switching to topic other |
|
56 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
57 $ hg topic --list |
|
58 ### topic: other |
|
59 ### branch: default |
|
60 t2@ c_b (current) |
|
61 t1: c_a |
|
62 $ hg phase --public 'topic("other")' |
|
63 $ hg up foo |
|
64 switching to topic foo |
|
65 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
66 |
|
67 Simple test |
|
68 ----------- |
|
69 |
|
70 'hg stack' list all changeset in the topic |
|
71 |
|
72 $ hg topic |
|
73 * foo |
|
74 $ hg stack |
|
75 ### topic: foo |
|
76 ### branch: default |
|
77 t4@ c_f (current) |
|
78 t3: c_e |
|
79 t2: c_d |
|
80 t1: c_c |
|
81 ^ c_b |
|
82 $ hg stack -Tjson | python -m json.tool |
|
83 [ |
|
84 { |
|
85 "isentry": true, |
|
86 "topic.stack.desc": "c_f", |
|
87 "topic.stack.index": 4, |
|
88 "topic.stack.state": [ |
|
89 "current" |
|
90 ], |
|
91 "topic.stack.state.symbol": "@" |
|
92 }, |
|
93 { |
|
94 "isentry": true, |
|
95 "topic.stack.desc": "c_e", |
|
96 "topic.stack.index": 3, |
|
97 "topic.stack.state": [ |
|
98 "clean" |
|
99 ], |
|
100 "topic.stack.state.symbol": ":" |
|
101 }, |
|
102 { |
|
103 "isentry": true, |
|
104 "topic.stack.desc": "c_d", |
|
105 "topic.stack.index": 2, |
|
106 "topic.stack.state": [ |
|
107 "clean" |
|
108 ], |
|
109 "topic.stack.state.symbol": ":" |
|
110 }, |
|
111 { |
|
112 "isentry": true, |
|
113 "topic.stack.desc": "c_c", |
|
114 "topic.stack.index": 1, |
|
115 "topic.stack.state": [ |
|
116 "clean" |
|
117 ], |
|
118 "topic.stack.state.symbol": ":" |
|
119 }, |
|
120 { |
|
121 "isentry": false, |
|
122 "topic.stack.desc": "c_b", |
|
123 "topic.stack.state": [ |
|
124 "base" |
|
125 ], |
|
126 "topic.stack.state.symbol": "^" |
|
127 } |
|
128 ] |
|
129 |
|
130 error case, nothing to list |
|
131 |
|
132 $ hg topic --clear |
|
133 $ hg stack |
|
134 ### branch: |
|
135 |
|
136 Test "t#" reference |
|
137 ------------------- |
|
138 |
|
139 |
|
140 $ hg up t2 |
|
141 abort: cannot resolve "t2": no active topic |
|
142 [255] |
|
143 $ hg topic foo |
|
144 $ hg up t42 |
|
145 abort: cannot resolve "t42": topic "foo" has only 4 changesets |
|
146 [255] |
|
147 $ hg up t2 |
|
148 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
149 $ hg summary |
|
150 parent: 3:e629654d7050 |
|
151 c_d |
|
152 branch: default |
|
153 commit: (clean) |
|
154 update: (current) |
|
155 phases: 4 draft |
|
156 topic: foo |
|
157 |
|
158 Case with some of the topic unstable |
|
159 ------------------------------------ |
|
160 |
|
161 $ echo bbb > ddd |
|
162 $ hg commit --amend |
|
163 $ hg log -G |
|
164 @ 7 default {foo} draft c_d |
|
165 | |
|
166 | o 5 default {foo} draft c_f |
|
167 | | |
|
168 | o 4 default {foo} draft c_e |
|
169 | | |
|
170 | x 3 default {foo} draft c_d |
|
171 |/ |
|
172 o 2 default {foo} draft c_c |
|
173 | |
|
174 o 1 default {} public c_b |
|
175 | |
|
176 o 0 default {} public c_a |
|
177 |
|
178 $ hg topic --list |
|
179 ### topic: foo |
|
180 ### branch: default |
|
181 t4$ c_f (unstable) |
|
182 t3$ c_e (unstable) |
|
183 t2@ c_d (current) |
|
184 t1: c_c |
|
185 ^ c_b |
|
186 $ hg up t3 |
|
187 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
188 $ hg topic --list |
|
189 ### topic: foo |
|
190 ### branch: default |
|
191 t4$ c_f (unstable) |
|
192 t3$ c_e (current unstable) |
|
193 t2: c_d |
|
194 t1: c_c |
|
195 ^ c_b |
|
196 $ hg topic --list --color=debug |
|
197 [topic.stack.summary.topic|### topic: [topic.active|foo]] |
|
198 [topic.stack.summary.branches|### branch: default] |
|
199 [topic.stack.index topic.stack.index.unstable|t4][topic.stack.state topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.unstable|c_f][topic.stack.state topic.stack.state.unstable| (unstable)] |
|
200 [topic.stack.index topic.stack.index.current topic.stack.index.unstable|t3][topic.stack.state topic.stack.state.current topic.stack.state.unstable|$] [topic.stack.desc topic.stack.desc.current topic.stack.desc.unstable|c_e][topic.stack.state topic.stack.state.current topic.stack.state.unstable| (current unstable)] |
|
201 [topic.stack.index topic.stack.index.clean|t2][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_d] |
|
202 [topic.stack.index topic.stack.index.clean|t1][topic.stack.state topic.stack.state.clean|:] [topic.stack.desc topic.stack.desc.clean|c_c] |
|
203 [topic.stack.state topic.stack.state.base|^] [topic.stack.desc topic.stack.desc.base|c_b] |
|
204 $ hg up t2 |
|
205 1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
206 |
|
207 Also test the revset: |
|
208 |
|
209 $ hg log -r 'stack()' |
|
210 2 default {foo} draft c_c |
|
211 7 default {foo} draft c_d |
|
212 4 default {foo} draft c_e |
|
213 5 default {foo} draft c_f |
|
214 |
|
215 $ hg log -r 'stack(foo)' |
|
216 hg: parse error: stack() takes no argument, it works on current topic |
|
217 [255] |
|
218 |
|
219 $ hg log -r 'stack(foobar)' |
|
220 hg: parse error: stack() takes no argument, it works on current topic |
|
221 [255] |
|
222 |
|
223 Case with multiple heads on the topic |
|
224 ------------------------------------- |
|
225 |
|
226 Make things linear again |
|
227 |
|
228 $ hg rebase -s 'desc(c_e)' -d 'desc(c_d) - obsolete()' |
|
229 rebasing 4:0f9ac936c87d "c_e" |
|
230 rebasing 5:6559e6d93aea "c_f" |
|
231 $ hg log -G |
|
232 o 9 default {foo} draft c_f |
|
233 | |
|
234 o 8 default {foo} draft c_e |
|
235 | |
|
236 @ 7 default {foo} draft c_d |
|
237 | |
|
238 o 2 default {foo} draft c_c |
|
239 | |
|
240 o 1 default {} public c_b |
|
241 | |
|
242 o 0 default {} public c_a |
|
243 |
|
244 |
|
245 |
|
246 Create the second branch |
|
247 |
|
248 $ hg up 'desc(c_d)' |
|
249 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
250 $ echo aaa > ggg |
|
251 $ hg add ggg |
|
252 $ hg commit -m c_g |
|
253 $ echo aaa > hhh |
|
254 $ hg add hhh |
|
255 $ hg commit -m c_h |
|
256 $ hg log -G |
|
257 @ 11 default {foo} draft c_h |
|
258 | |
|
259 o 10 default {foo} draft c_g |
|
260 | |
|
261 | o 9 default {foo} draft c_f |
|
262 | | |
|
263 | o 8 default {foo} draft c_e |
|
264 |/ |
|
265 o 7 default {foo} draft c_d |
|
266 | |
|
267 o 2 default {foo} draft c_c |
|
268 | |
|
269 o 1 default {} public c_b |
|
270 | |
|
271 o 0 default {} public c_a |
|
272 |
|
273 |
|
274 Test output |
|
275 |
|
276 $ hg top -l |
|
277 ### topic: foo (2 heads) |
|
278 ### branch: default |
|
279 t6: c_f |
|
280 t5: c_e |
|
281 t2^ c_d (base) |
|
282 t4@ c_h (current) |
|
283 t3: c_g |
|
284 t2: c_d |
|
285 t1: c_c |
|
286 ^ c_b |
|
287 |
|
288 Case with multiple heads on the topic with unstability involved |
|
289 --------------------------------------------------------------- |
|
290 |
|
291 We amend the message to make sure the display base pick the right changeset |
|
292 |
|
293 $ hg up 'desc(c_d)' |
|
294 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
295 $ echo ccc > ddd |
|
296 $ hg commit --amend -m 'c_D' |
|
297 $ hg rebase -d . -s 'desc(c_g)' |
|
298 rebasing 10:81264ae8a36a "c_g" |
|
299 rebasing 11:fde5f5941642 "c_h" |
|
300 $ hg log -G |
|
301 o 15 default {foo} draft c_h |
|
302 | |
|
303 o 14 default {foo} draft c_g |
|
304 | |
|
305 @ 13 default {foo} draft c_D |
|
306 | |
|
307 | o 9 default {foo} draft c_f |
|
308 | | |
|
309 | o 8 default {foo} draft c_e |
|
310 | | |
|
311 | x 7 default {foo} draft c_d |
|
312 |/ |
|
313 o 2 default {foo} draft c_c |
|
314 | |
|
315 o 1 default {} public c_b |
|
316 | |
|
317 o 0 default {} public c_a |
|
318 |
|
319 |
|
320 $ hg topic --list |
|
321 ### topic: foo (2 heads) |
|
322 ### branch: default |
|
323 t6$ c_f (unstable) |
|
324 t5$ c_e (unstable) |
|
325 t2^ c_D (base) |
|
326 t4: c_h |
|
327 t3: c_g |
|
328 t2@ c_D (current) |
|
329 t1: c_c |
|
330 ^ c_b |
|
331 |
|
332 Trying to list non existing topic |
|
333 $ hg stack thisdoesnotexist |
|
334 abort: cannot resolve "thisdoesnotexist": no such topic found |
|
335 [255] |
|
336 $ hg topic --list thisdoesnotexist |
|
337 abort: cannot resolve "thisdoesnotexist": no such topic found |
|
338 [255] |
|
339 |
|