comparison tests/test-topic.t @ 2109:90ab79764ce4 mercurial-4.0

mercurial-4.0: merge with future 6.0.0 A new version will be released soon, we start handling mismatch in test output to make the actual release time smoother.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 14 Mar 2017 14:38:10 -0700
parents db617700d318
children 26ec0839865b
comparison
equal deleted inserted replaced
1815:ee2d5716ef0a 2109:90ab79764ce4
1 $ . "$TESTDIR/testlib/topic_setup.sh"
2
3 $ hg init pinky
4 $ cd pinky
5 $ cat <<EOF >> .hg/hgrc
6 > [phases]
7 > publish=false
8 > EOF
9 $ cat <<EOF >> $HGRCPATH
10 > [experimental]
11 > # disable the new graph style until we drop 3.7 support
12 > graphstyle.missing = |
13 > EOF
14
15 $ hg help topics
16 hg topics [TOPIC]
17
18 View current topic, set current topic, or see all topics.
19
20 The --verbose version of this command display various information on the
21 state of each topic.
22
23 options:
24
25 --clear clear active topic if any
26 --change VALUE revset of existing revisions to change topic
27 -l --list show the stack of changeset in the topic
28
29 (some details hidden, use --verbose to show complete help)
30 $ hg topics
31
32 Test topics interaction with evolution:
33
34 $ hg topics --config experimental.evolution=
35 $ hg topics --config experimental.evolution= --change . bob
36 abort: must have obsolete enabled to use --change
37 [255]
38
39 Create some changes:
40
41 $ for x in alpha beta gamma delta ; do
42 > echo file $x >> $x
43 > hg addremove
44 > hg ci -m "Add file $x"
45 > done
46 adding alpha
47 adding beta
48 adding gamma
49 adding delta
50
51 Still no topics
52 $ hg topics
53
54 Test commit flag and help text
55
56 $ echo stuff >> alpha
57 $ HGEDITOR=cat hg ci -t topicflag
58
59
60 HG: Enter commit message. Lines beginning with 'HG:' are removed.
61 HG: Leave message empty to abort commit.
62 HG: --
63 HG: user: test
64 HG: topic 'topicflag'
65 HG: branch 'default'
66 HG: changed alpha
67 abort: empty commit message
68 [255]
69 $ hg revert alpha
70 $ hg topic
71 * topicflag
72
73 Make a topic
74 $ hg topic narf
75 $ hg topics
76 * narf
77 $ echo topic work >> alpha
78 $ hg ci -m 'start on narf'
79 $ hg co .^
80 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
81 $ hg topic fran
82 $ hg topics
83 * fran
84 narf
85 $ echo >> fran work >> beta
86 $ hg ci -m 'start on fran'
87 $ hg co narf
88 switching to topic narf
89 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
90 $ hg topic
91 fran
92 * narf
93 $ hg log -r . -T '{topics}\n'
94 narf
95 $ echo 'narf!!!' >> alpha
96 $ hg ci -m 'narf!'
97 $ hg log -G
98 @ changeset: 6:7c34953036d6
99 | tag: tip
100 | topic: narf
101 | parent: 4:fb147b0b417c
102 | user: test
103 | date: Thu Jan 01 00:00:00 1970 +0000
104 | summary: narf!
105 |
106 | o changeset: 5:0469d521db49
107 | | topic: fran
108 | | parent: 3:a53952faf762
109 | | user: test
110 | | date: Thu Jan 01 00:00:00 1970 +0000
111 | | summary: start on fran
112 | |
113 o | changeset: 4:fb147b0b417c
114 |/ topic: narf
115 | user: test
116 | date: Thu Jan 01 00:00:00 1970 +0000
117 | summary: start on narf
118 |
119 o changeset: 3:a53952faf762
120 | user: test
121 | date: Thu Jan 01 00:00:00 1970 +0000
122 | summary: Add file delta
123 |
124 o changeset: 2:15d1eb11d2fa
125 | user: test
126 | date: Thu Jan 01 00:00:00 1970 +0000
127 | summary: Add file gamma
128 |
129 o changeset: 1:c692ea2c9224
130 | user: test
131 | date: Thu Jan 01 00:00:00 1970 +0000
132 | summary: Add file beta
133 |
134 o changeset: 0:c2b7d2f7d14b
135 user: test
136 date: Thu Jan 01 00:00:00 1970 +0000
137 summary: Add file alpha
138
139
140 Exchanging of topics:
141 $ cd ..
142 $ hg init brain
143 $ hg -R pinky push -r 4 brain
144 pushing to brain
145 searching for changes
146 adding changesets
147 adding manifests
148 adding file changes
149 added 5 changesets with 5 changes to 4 files
150
151 Export
152
153 $ hg -R pinky export
154 # HG changeset patch
155 # User test
156 # Date 0 0
157 # Thu Jan 01 00:00:00 1970 +0000
158 # Node ID 7c34953036d6a36eae468c550d0592b89ee8bffc
159 # Parent fb147b0b417c25ca15547cd945acf51cf8dcaf02
160 # EXP-Topic narf
161 narf!
162
163 diff -r fb147b0b417c -r 7c34953036d6 alpha
164 --- a/alpha Thu Jan 01 00:00:00 1970 +0000
165 +++ b/alpha Thu Jan 01 00:00:00 1970 +0000
166 @@ -1,2 +1,3 @@
167 file alpha
168 topic work
169 +narf!!!
170
171 Import
172
173 $ hg -R pinky export > narf.diff
174 $ hg -R pinky --config extensions.strip= strip .
175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
176 saved backup bundle to $TESTTMP/pinky/.hg/strip-backup/7c34953036d6-1ff3bae2-backup.hg (glob)
177 $ hg -R pinky import narf.diff
178 applying narf.diff
179 $ hg -R pinky log -r .
180 changeset: 6:7c34953036d6
181 tag: tip
182 topic: narf
183 parent: 4:fb147b0b417c
184 user: test
185 date: Thu Jan 01 00:00:00 1970 +0000
186 summary: narf!
187
188 Now that we've pushed to brain, the work done on narf is no longer a
189 draft, so we won't see that topic name anymore:
190
191 $ hg log -R pinky -G
192 @ changeset: 6:7c34953036d6
193 | tag: tip
194 | topic: narf
195 | parent: 4:fb147b0b417c
196 | user: test
197 | date: Thu Jan 01 00:00:00 1970 +0000
198 | summary: narf!
199 |
200 | o changeset: 5:0469d521db49
201 | | topic: fran
202 | | parent: 3:a53952faf762
203 | | user: test
204 | | date: Thu Jan 01 00:00:00 1970 +0000
205 | | summary: start on fran
206 | |
207 o | changeset: 4:fb147b0b417c
208 |/ user: test
209 | date: Thu Jan 01 00:00:00 1970 +0000
210 | summary: start on narf
211 |
212 o changeset: 3:a53952faf762
213 | user: test
214 | date: Thu Jan 01 00:00:00 1970 +0000
215 | summary: Add file delta
216 |
217 o changeset: 2:15d1eb11d2fa
218 | user: test
219 | date: Thu Jan 01 00:00:00 1970 +0000
220 | summary: Add file gamma
221 |
222 o changeset: 1:c692ea2c9224
223 | user: test
224 | date: Thu Jan 01 00:00:00 1970 +0000
225 | summary: Add file beta
226 |
227 o changeset: 0:c2b7d2f7d14b
228 user: test
229 date: Thu Jan 01 00:00:00 1970 +0000
230 summary: Add file alpha
231
232 $ cd brain
233 $ hg co tip
234 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
235
236 Because the change is public, we won't inherit the topic from narf.
237
238 $ hg topic
239 $ echo what >> alpha
240 $ hg topic query
241 $ hg ci -m 'what is narf, pinky?'
242 $ hg log -Gl2
243 @ changeset: 5:c01515cfc331
244 | tag: tip
245 | topic: query
246 | user: test
247 | date: Thu Jan 01 00:00:00 1970 +0000
248 | summary: what is narf, pinky?
249 |
250 o changeset: 4:fb147b0b417c
251 | user: test
252 | date: Thu Jan 01 00:00:00 1970 +0000
253 | summary: start on narf
254 |
255 $ hg push -f ../pinky -r query
256 pushing to ../pinky
257 searching for changes
258 adding changesets
259 adding manifests
260 adding file changes
261 added 1 changesets with 1 changes to 1 files (+1 heads)
262 $ hg -R ../pinky log -Gl 4
263 o changeset: 7:c01515cfc331
264 | tag: tip
265 | topic: query
266 | parent: 4:fb147b0b417c
267 | user: test
268 | date: Thu Jan 01 00:00:00 1970 +0000
269 | summary: what is narf, pinky?
270 |
271 | @ changeset: 6:7c34953036d6
272 |/ topic: narf
273 | parent: 4:fb147b0b417c
274 | user: test
275 | date: Thu Jan 01 00:00:00 1970 +0000
276 | summary: narf!
277 |
278 | o changeset: 5:0469d521db49
279 | | topic: fran
280 | | parent: 3:a53952faf762
281 | | user: test
282 | | date: Thu Jan 01 00:00:00 1970 +0000
283 | | summary: start on fran
284 | |
285 o | changeset: 4:fb147b0b417c
286 |/ user: test
287 | date: Thu Jan 01 00:00:00 1970 +0000
288 | summary: start on narf
289 |
290 $ hg topics
291 * query
292 $ cd ../pinky
293 $ hg co query
294 switching to topic query
295 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 $ echo answer >> alpha
297 $ hg ci -m 'Narf is like `zort` or `poit`!'
298 $ hg merge narf
299 merging alpha
300 warning: conflicts while merging alpha! (edit, then use 'hg resolve --mark')
301 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
302 use 'hg resolve' to retry unresolved file merges or 'hg update -C .' to abandon
303 [1]
304 $ hg revert -r narf alpha
305 $ hg resolve -m alpha
306 (no more unresolved files)
307 $ hg topic narf
308 $ hg ci -m 'Finish narf'
309 $ hg topics
310 fran
311 * narf
312 query
313 $ hg debugnamecomplete # branch:topic here is a buggy side effect
314 default
315 default:fran
316 default:narf
317 default:query
318 fran
319 narf
320 query
321 tip
322 $ hg phase --public narf
323
324 POSSIBLE BUG: narf topic stays alive even though we just made all
325 narf commits public:
326
327 $ hg topics
328 fran
329 * narf
330 $ hg log -Gl 6
331 @ changeset: 9:ae074045b7a7
332 |\ tag: tip
333 | | parent: 8:54c943c1c167
334 | | parent: 6:7c34953036d6
335 | | user: test
336 | | date: Thu Jan 01 00:00:00 1970 +0000
337 | | summary: Finish narf
338 | |
339 | o changeset: 8:54c943c1c167
340 | | user: test
341 | | date: Thu Jan 01 00:00:00 1970 +0000
342 | | summary: Narf is like `zort` or `poit`!
343 | |
344 | o changeset: 7:c01515cfc331
345 | | parent: 4:fb147b0b417c
346 | | user: test
347 | | date: Thu Jan 01 00:00:00 1970 +0000
348 | | summary: what is narf, pinky?
349 | |
350 o | changeset: 6:7c34953036d6
351 |/ parent: 4:fb147b0b417c
352 | user: test
353 | date: Thu Jan 01 00:00:00 1970 +0000
354 | summary: narf!
355 |
356 | o changeset: 5:0469d521db49
357 | | topic: fran
358 | | parent: 3:a53952faf762
359 | | user: test
360 | | date: Thu Jan 01 00:00:00 1970 +0000
361 | | summary: start on fran
362 | |
363 o | changeset: 4:fb147b0b417c
364 |/ user: test
365 | date: Thu Jan 01 00:00:00 1970 +0000
366 | summary: start on narf
367 |
368 $ cd ../brain
369 $ hg topics
370 * query
371 $ hg pull ../pinky -r narf
372 pulling from ../pinky
373 abort: unknown revision 'narf'!
374 [255]
375 $ hg pull ../pinky -r default
376 pulling from ../pinky
377 searching for changes
378 adding changesets
379 adding manifests
380 adding file changes
381 added 3 changesets with 3 changes to 1 files
382 (run 'hg update' to get a working copy)
383 $ hg topics
384 * query
385
386 We can pull in the draft-phase change and we get the new topic
387
388 $ hg pull ../pinky
389 pulling from ../pinky
390 searching for changes
391 adding changesets
392 adding manifests
393 adding file changes
394 added 1 changesets with 1 changes to 1 files (+1 heads)
395 (run 'hg heads' to see heads)
396 $ hg topics
397 fran
398 * query
399 $ hg log -Gr 'draft()'
400 o changeset: 9:0469d521db49
401 | tag: tip
402 | topic: fran
403 | parent: 3:a53952faf762
404 | user: test
405 | date: Thu Jan 01 00:00:00 1970 +0000
406 | summary: start on fran
407 |
408
409 query is not an open topic, so when we clear the current topic it'll
410 disappear:
411
412 $ hg topics --clear
413 $ hg topics
414 fran
415
416 --clear when we don't have an active topic isn't an error:
417
418 $ hg topics --clear
419
420 Topic revset
421 $ hg log -r 'topic()' -G
422 o changeset: 9:0469d521db49
423 | tag: tip
424 | topic: fran
425 | parent: 3:a53952faf762
426 | user: test
427 | date: Thu Jan 01 00:00:00 1970 +0000
428 | summary: start on fran
429 |
430 $ hg log -r 'not topic()' -G
431 o changeset: 8:ae074045b7a7
432 |\ parent: 7:54c943c1c167
433 | | parent: 6:7c34953036d6
434 | | user: test
435 | | date: Thu Jan 01 00:00:00 1970 +0000
436 | | summary: Finish narf
437 | |
438 | o changeset: 7:54c943c1c167
439 | | parent: 5:c01515cfc331
440 | | user: test
441 | | date: Thu Jan 01 00:00:00 1970 +0000
442 | | summary: Narf is like `zort` or `poit`!
443 | |
444 o | changeset: 6:7c34953036d6
445 | | parent: 4:fb147b0b417c
446 | | user: test
447 | | date: Thu Jan 01 00:00:00 1970 +0000
448 | | summary: narf!
449 | |
450 | @ changeset: 5:c01515cfc331
451 |/ user: test
452 | date: Thu Jan 01 00:00:00 1970 +0000
453 | summary: what is narf, pinky?
454 |
455 o changeset: 4:fb147b0b417c
456 | user: test
457 | date: Thu Jan 01 00:00:00 1970 +0000
458 | summary: start on narf
459 |
460 o changeset: 3:a53952faf762
461 | user: test
462 | date: Thu Jan 01 00:00:00 1970 +0000
463 | summary: Add file delta
464 |
465 o changeset: 2:15d1eb11d2fa
466 | user: test
467 | date: Thu Jan 01 00:00:00 1970 +0000
468 | summary: Add file gamma
469 |
470 o changeset: 1:c692ea2c9224
471 | user: test
472 | date: Thu Jan 01 00:00:00 1970 +0000
473 | summary: Add file beta
474 |
475 o changeset: 0:c2b7d2f7d14b
476 user: test
477 date: Thu Jan 01 00:00:00 1970 +0000
478 summary: Add file alpha
479
480 No matches because narf is already closed:
481 $ hg log -r 'topic(narf)' -G
482 This regexp should match the topic `fran`:
483 $ hg log -r 'topic("re:.ra.")' -G
484 o changeset: 9:0469d521db49
485 | tag: tip
486 | topic: fran
487 | parent: 3:a53952faf762
488 | user: test
489 | date: Thu Jan 01 00:00:00 1970 +0000
490 | summary: start on fran
491 |
492 Exact match on fran:
493 $ hg log -r 'topic(fran)' -G
494 o changeset: 9:0469d521db49
495 | tag: tip
496 | topic: fran
497 | parent: 3:a53952faf762
498 | user: test
499 | date: Thu Jan 01 00:00:00 1970 +0000
500 | summary: start on fran
501 |
502
503 Match current topic:
504 $ hg topic
505 fran
506 $ hg log -r 'topic(.)'
507 (no output is expected)
508 $ hg co fran
509 switching to topic fran
510 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
511 $ hg log -r 'topic(.)'
512 changeset: 9:0469d521db49
513 tag: tip
514 topic: fran
515 parent: 3:a53952faf762
516 user: test
517 date: Thu Jan 01 00:00:00 1970 +0000
518 summary: start on fran
519
520
521 Deactivate the topic.
522 $ hg topics
523 * fran
524 $ hg topics --clear
525 $ echo fran? >> beta
526 $ hg ci -m 'fran?'
527 created new head
528 $ hg log -Gr 'draft()'
529 @ changeset: 10:4073470c35e1
530 | tag: tip
531 | user: test
532 | date: Thu Jan 01 00:00:00 1970 +0000
533 | summary: fran?
534 |
535 o changeset: 9:0469d521db49
536 | topic: fran
537 | parent: 3:a53952faf762
538 | user: test
539 | date: Thu Jan 01 00:00:00 1970 +0000
540 | summary: start on fran
541 |
542 $ hg topics
543 fran
544 Changing topic fails if we don't give a topic
545 $ hg topic --change 9
546 abort: changing topic requires a topic name or --clear
547 [255]
548
549 Can't change topic of a public change
550 $ hg topic --change 1:: --clear
551 abort: can't change topic of a public change
552 [255]
553
554 Can clear topics
555 $ hg topic --change 9 --clear
556 changed topic on 1 changes
557 please run hg evolve --rev "not topic()" now
558 $ hg log -Gr 'draft() and not obsolete()'
559 o changeset: 11:783930e1d79e
560 | tag: tip
561 | parent: 3:a53952faf762
562 | user: test
563 | date: Thu Jan 01 00:00:00 1970 +0000
564 | summary: start on fran
565 |
566 | @ changeset: 10:4073470c35e1
567 | | user: test
568 | | date: Thu Jan 01 00:00:00 1970 +0000
569 | | summary: fran?
570 | |
571
572 Normally you'd do this with evolve, but we'll use rebase to avoid
573 bonus deps in the testsuite.
574
575 $ hg rebase -d tip -s .
576 rebasing 10:4073470c35e1 "fran?"
577
578 Can add a topic to an existing change
579 $ hg topic --change 11 wat
580 changed topic on 1 changes
581 please run hg evolve --rev "topic(wat)" now
582 $ hg log -Gr 'draft() and not obsolete()'
583 o changeset: 13:d91cd8fd490e
584 | tag: tip
585 | topic: wat
586 | parent: 3:a53952faf762
587 | user: test
588 | date: Thu Jan 01 00:00:00 1970 +0000
589 | summary: start on fran
590 |
591 | @ changeset: 12:d9e32f4c4806
592 | | user: test
593 | | date: Thu Jan 01 00:00:00 1970 +0000
594 | | summary: fran?
595 | |
596
597 Normally you'd do this with evolve, but we'll use rebase to avoid
598 bonus deps in the testsuite.
599
600 $ hg rebase -d tip -s .
601 rebasing 12:d9e32f4c4806 "fran?"
602
603 $ hg log -Gr 'draft()'
604 @ changeset: 14:cf24ad8bbef5
605 | tag: tip
606 | topic: wat
607 | user: test
608 | date: Thu Jan 01 00:00:00 1970 +0000
609 | summary: fran?
610 |
611 o changeset: 13:d91cd8fd490e
612 | topic: wat
613 | parent: 3:a53952faf762
614 | user: test
615 | date: Thu Jan 01 00:00:00 1970 +0000
616 | summary: start on fran
617 |
618
619 Amend a topic
620
621 $ hg topic watwat
622 $ hg ci --amend
623 $ hg log -Gr 'draft()'
624 @ changeset: 16:893ffcf66c1f
625 | tag: tip
626 | topic: watwat
627 | parent: 13:d91cd8fd490e
628 | user: test
629 | date: Thu Jan 01 00:00:00 1970 +0000
630 | summary: fran?
631 |
632 o changeset: 13:d91cd8fd490e
633 | topic: wat
634 | parent: 3:a53952faf762
635 | user: test
636 | date: Thu Jan 01 00:00:00 1970 +0000
637 | summary: start on fran
638 |
639
640 Clear and amend:
641
642 $ hg topic --clear
643 $ hg ci --amend
644 $ hg log -r .
645 changeset: 18:a13639e22b65
646 tag: tip
647 parent: 13:d91cd8fd490e
648 user: test
649 date: Thu Jan 01 00:00:00 1970 +0000
650 summary: fran?
651
652 Readding the same topic with topic --change should work:
653 $ hg topic --change . watwat
654 changed topic on 1 changes