comparison tests/test-topic.t @ 3000:bd7e8be29542 stable

branching: merge future 6.7.0 in the stable branch We are getting ready to release a new version.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 27 Sep 2017 00:54:28 +0200
parents a61634f52742
children 67b59d1657cf 945a0989e41b
comparison
equal deleted inserted replaced
2852:0d16c89aa185 3000:bd7e8be29542
1 $ . "$TESTDIR/testlib/topic_setup.sh" 1 $ . "$TESTDIR/testlib/topic_setup.sh"
2 2
3 $ hg init pinky 3 $ hg init pinky --traceback
4 $ cd pinky 4 $ cd pinky
5 $ cat <<EOF >> .hg/hgrc 5 $ cat <<EOF >> .hg/hgrc
6 > [phases] 6 > [phases]
7 > publish=false 7 > publish=false
8 > EOF 8 > EOF
17 17
18 View current topic, set current topic, change topic for a set of revisions, or 18 View current topic, set current topic, change topic for a set of revisions, or
19 see all topics. 19 see all topics.
20 20
21 Clear topic on existing topiced revisions: 21 Clear topic on existing topiced revisions:
22 'hg topic --rev <related revset> --clear' 22
23 hg topics --rev <related revset> --clear
23 24
24 Change topic on some revisions: 25 Change topic on some revisions:
25 'hg topic <newtopicname> --rev <related revset>' 26
27 hg topics <newtopicname> --rev <related revset>
26 28
27 Clear current topic: 29 Clear current topic:
28 'hg topic --clear' 30
31 hg topics --clear
29 32
30 Set current topic: 33 Set current topic:
31 'hg topic <topicname>' 34
35 hg topics <topicname>
32 36
33 List of topics: 37 List of topics:
34 'hg topics' 38
35 39 hg topics
36 List of topics with their last touched time sorted according to it: 40
37 'hg topic --age' 41 List of topics sorted according to their last touched time displaying last
42 touched time and the user who last touched the topic:
43
44 hg topics --age
38 45
39 The active topic (if any) will be prepended with a "*". 46 The active topic (if any) will be prepended with a "*".
47
48 The '--current' flag helps to take active topic into account. For example,
49 if you want to set the topic on all the draft changesets to the active
50 topic, you can do: 'hg topics -r "draft()" --current'
40 51
41 The --verbose version of this command display various information on the 52 The --verbose version of this command display various information on the
42 state of each topic. 53 state of each topic.
43 54
44 options: 55 options ([+] can be repeated):
45 56
46 --clear clear active topic if any 57 --clear clear active topic if any
47 -r --rev REV revset of existing revisions 58 -r --rev REV [+] revset of existing revisions
48 -l --list show the stack of changeset in the topic 59 -l --list show the stack of changeset in the topic
49 --age show when you last touched the topics 60 --age show when you last touched the topics
61 --current display the current topic only
50 62
51 (some details hidden, use --verbose to show complete help) 63 (some details hidden, use --verbose to show complete help)
52 $ hg topics 64 $ hg topics
53 65
54 Test topics interaction with evolution: 66 Test topics interaction with evolution:
70 adding gamma 82 adding gamma
71 adding delta 83 adding delta
72 84
73 Still no topics 85 Still no topics
74 $ hg topics 86 $ hg topics
87 $ hg topics --current
88 no active topic
89 [1]
90 $ hg topics --current somerandomtopic
91 abort: cannot use --current when setting a topic
92 [255]
93 $ hg topics --current --clear
94 abort: cannot use --current and --clear
95 [255]
96 $ hg topics --clear somerandomtopic
97 abort: cannot use --clear when setting a topic
98 [255]
99
100 Trying some invalid topicnames
101
102 $ hg topic '.'
103 abort: the name '.' is reserved
104 [255]
105 $ hg topic null
106 abort: the name 'null' is reserved
107 [255]
108 $ hg topic tip
109 abort: the name 'tip' is reserved
110 [255]
111 $ hg topic 12345
112 abort: cannot use an integer as a name
113 [255]
114 $ hg topic ' '
115 abort: topic name cannot consist entirely of whitespaces
116 [255]
75 117
76 Test commit flag and help text 118 Test commit flag and help text
77 119
78 $ echo stuff >> alpha 120 $ echo stuff >> alpha
79 $ HGEDITOR=cat hg ci -t topicflag 121 $ HGEDITOR=cat hg ci -t topicflag
91 $ hg revert alpha 133 $ hg revert alpha
92 $ hg topic 134 $ hg topic
93 * topicflag 135 * topicflag
94 136
95 Make a topic 137 Make a topic
138
96 $ hg topic narf 139 $ hg topic narf
97 $ hg topics 140 $ hg topics
98 * narf 141 * narf
142 $ hg topics -v
143 * narf (on branch: default, 0 changesets)
144 $ hg stack
145 ### topic: narf
146 ### target: default (branch)
147 (stack is empty)
148 t0^ Add file delta (base)
149
150 Add commits to topic
151
99 $ echo topic work >> alpha 152 $ echo topic work >> alpha
100 $ hg ci -m 'start on narf' 153 $ hg ci -m 'start on narf'
154 active topic 'narf' grew its first changeset
101 $ hg co .^ 155 $ hg co .^
102 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 156 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
103 $ hg topic fran 157 $ hg topic fran
158 marked working directory as topic: fran
104 $ hg topics 159 $ hg topics
105 * fran 160 * fran
106 narf 161 narf
162 $ hg topics --current
163 fran
107 $ echo >> fran work >> beta 164 $ echo >> fran work >> beta
108 $ hg ci -m 'start on fran' 165 $ hg ci -m 'start on fran'
166 active topic 'fran' grew its first changeset
109 $ hg co narf 167 $ hg co narf
110 switching to topic narf 168 switching to topic narf
111 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 169 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
112 $ hg topic 170 $ hg topic
113 fran 171 fran
258 Because the change is public, we won't inherit the topic from narf. 316 Because the change is public, we won't inherit the topic from narf.
259 317
260 $ hg topic 318 $ hg topic
261 $ echo what >> alpha 319 $ echo what >> alpha
262 $ hg topic query 320 $ hg topic query
321 marked working directory as topic: query
263 $ hg ci -m 'what is narf, pinky?' 322 $ hg ci -m 'what is narf, pinky?'
323 active topic 'query' grew its first changeset
264 $ hg log -Gl2 324 $ hg log -Gl2
265 @ changeset: 5:c01515cfc331 325 @ changeset: 5:c01515cfc331
266 | tag: tip 326 | tag: tip
267 | topic: query 327 | topic: query
268 | user: test 328 | user: test
272 o changeset: 4:fb147b0b417c 332 o changeset: 4:fb147b0b417c
273 | user: test 333 | user: test
274 | date: Thu Jan 01 00:00:00 1970 +0000 334 | date: Thu Jan 01 00:00:00 1970 +0000
275 | summary: start on narf 335 | summary: start on narf
276 | 336 |
337
277 $ hg push -f ../pinky -r query 338 $ hg push -f ../pinky -r query
278 pushing to ../pinky 339 pushing to ../pinky
279 searching for changes 340 searching for changes
280 adding changesets 341 adding changesets
281 adding manifests 342 adding manifests
282 adding file changes 343 adding file changes
283 added 1 changesets with 1 changes to 1 files (+1 heads) 344 added 1 changesets with 1 changes to 1 files (+1 heads)
345
284 $ hg -R ../pinky log -Gl 4 346 $ hg -R ../pinky log -Gl 4
285 o changeset: 7:c01515cfc331 347 o changeset: 7:c01515cfc331
286 | tag: tip 348 | tag: tip
287 | topic: query 349 | topic: query
288 | parent: 4:fb147b0b417c 350 | parent: 4:fb147b0b417c
307 o | changeset: 4:fb147b0b417c 369 o | changeset: 4:fb147b0b417c
308 |/ user: test 370 |/ user: test
309 | date: Thu Jan 01 00:00:00 1970 +0000 371 | date: Thu Jan 01 00:00:00 1970 +0000
310 | summary: start on narf 372 | summary: start on narf
311 | 373 |
374
312 $ hg topics 375 $ hg topics
313 * query 376 * query
314 $ cd ../pinky 377 $ cd ../pinky
315 $ hg co query 378 $ hg co query
316 switching to topic query 379 switching to topic query
340 fran 403 fran
341 narf 404 narf
342 query 405 query
343 tip 406 tip
344 $ hg phase --public narf 407 $ hg phase --public narf
408 active topic 'narf' is now empty
345 409
346 POSSIBLE BUG: narf topic stays alive even though we just made all 410 POSSIBLE BUG: narf topic stays alive even though we just made all
347 narf commits public: 411 narf commits public:
348 412
349 $ hg topics 413 $ hg topics
385 o | changeset: 4:fb147b0b417c 449 o | changeset: 4:fb147b0b417c
386 |/ user: test 450 |/ user: test
387 | date: Thu Jan 01 00:00:00 1970 +0000 451 | date: Thu Jan 01 00:00:00 1970 +0000
388 | summary: start on narf 452 | summary: start on narf
389 | 453 |
454
390 $ cd ../brain 455 $ cd ../brain
391 $ hg topics 456 $ hg topics
392 * query 457 * query
393 $ hg pull ../pinky -r narf 458 $ hg pull ../pinky -r narf
394 pulling from ../pinky 459 pulling from ../pinky
399 searching for changes 464 searching for changes
400 adding changesets 465 adding changesets
401 adding manifests 466 adding manifests
402 adding file changes 467 adding file changes
403 added 3 changesets with 3 changes to 1 files 468 added 3 changesets with 3 changes to 1 files
469 active topic 'query' is now empty
404 (run 'hg update' to get a working copy) 470 (run 'hg update' to get a working copy)
405 $ hg topics 471 $ hg topics
406 * query 472 * query
407 473
408 We can pull in the draft-phase change and we get the new topic 474 We can pull in the draft-phase change and we get the new topic
430 496
431 query is not an open topic, so when we clear the current topic it'll 497 query is not an open topic, so when we clear the current topic it'll
432 disappear: 498 disappear:
433 499
434 $ hg topics --clear 500 $ hg topics --clear
501 clearing empty topic "query"
435 $ hg topics 502 $ hg topics
436 fran 503 fran
437 504
438 --clear when we don't have an active topic isn't an error: 505 --clear when we don't have an active topic isn't an error:
439 506
668 | 735 |
669 736
670 Amend a topic 737 Amend a topic
671 738
672 $ hg topic watwat 739 $ hg topic watwat
740 marked working directory as topic: watwat
673 $ hg ci --amend 741 $ hg ci --amend
742 active topic 'watwat' grew its first changeset
674 $ hg log -Gr 'draft()' 743 $ hg log -Gr 'draft()'
675 @ changeset: 16:6c40a4c21bbe 744 @ changeset: 16:6c40a4c21bbe
676 | tag: tip 745 | tag: tip
677 | topic: watwat 746 | topic: watwat
678 | parent: 13:686a642006db 747 | parent: 13:686a642006db
723 | user: test 792 | user: test
724 | date: Thu Jan 01 00:00:00 1970 +0000 793 | date: Thu Jan 01 00:00:00 1970 +0000
725 | summary: start on fran 794 | summary: start on fran
726 | 795 |
727 796
728 $ hg topics --rev '13::19' changewat 797 Using the current flag
729 switching to topic changewat 798
799 $ hg topic changewat
800 $ hg topics --rev '13::19' --current
801 active topic 'changewat' grew its 2 first changesets
730 changed topic on 2 changes 802 changed topic on 2 changes
803
731 $ hg log -Gr 'draft()' 804 $ hg log -Gr 'draft()'
732 @ changeset: 21:56c83be6105f 805 @ changeset: 21:56c83be6105f
733 | tag: tip 806 | tag: tip
734 | topic: changewat 807 | topic: changewat
735 | user: test 808 | user: test
750 0 files updated, 0 files merged, 0 files removed, 0 files unresolved 823 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
751 $ hg up t1 824 $ hg up t1
752 1 files updated, 0 files merged, 0 files removed, 0 files unresolved 825 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
753 $ echo gamma >> gamma 826 $ echo gamma >> gamma
754 $ hg ci -m gamma 827 $ hg ci -m gamma
828
755 $ hg log -Gr 'draft()' 829 $ hg log -Gr 'draft()'
756 @ changeset: 22:0d3d805542b4 830 @ changeset: 22:0d3d805542b4
757 | tag: tip 831 | tag: tip
758 | topic: changewat 832 | topic: changewat
759 | parent: 20:ceba5be9d56f 833 | parent: 20:ceba5be9d56f
772 | parent: 3:a53952faf762 846 | parent: 3:a53952faf762
773 | user: test 847 | user: test
774 | date: Thu Jan 01 00:00:00 1970 +0000 848 | date: Thu Jan 01 00:00:00 1970 +0000
775 | summary: start on fran 849 | summary: start on fran
776 | 850 |
851
777 $ hg topics --rev 't1::' changewut 852 $ hg topics --rev 't1::' changewut
778 switching to topic changewut 853 switching to topic changewut
854 active topic 'changewat' is now empty
779 changed topic on 3 changes 855 changed topic on 3 changes
856
780 $ hg log -Gr 'draft()' 857 $ hg log -Gr 'draft()'
781 @ changeset: 25:729ed5717393 858 @ changeset: 25:729ed5717393
782 | tag: tip 859 | tag: tip
783 | topic: changewut 860 | topic: changewut
784 | parent: 23:62e49f09f883 861 | parent: 23:62e49f09f883
803 Testing for updating to t0 880 Testing for updating to t0
804 ========================== 881 ==========================
805 882
806 $ hg stack 883 $ hg stack
807 ### topic: changewut (2 heads) 884 ### topic: changewut (2 heads)
808 ### branch: default, 5 behind 885 ### target: default (branch), 5 behind
809 t3: fran? 886 t3: fran?
810 t1^ start on fran (base) 887 t1^ start on fran (base)
811 t2@ gamma (current) 888 t2@ gamma (current)
812 t1: start on fran 889 t1: start on fran
813 t0^ Add file delta (base) 890 t0^ Add file delta (base)
891
814 $ hg up t0 892 $ hg up t0
815 preserving the current topic 'changewut' 893 preserving the current topic 'changewut'
816 2 files updated, 0 files merged, 0 files removed, 0 files unresolved 894 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
895
817 $ hg topic 896 $ hg topic
818 * changewut 897 * changewut
819 $ hg stack 898 $ hg stack
820 ### topic: changewut (2 heads) 899 ### topic: changewut (2 heads)
821 ### branch: default, 5 behind 900 ### target: default (branch), 5 behind
822 t3: fran? 901 t3: fran?
823 t1^ start on fran (base) 902 t1^ start on fran (base)
824 t2: gamma 903 t2: gamma
825 t1: start on fran 904 t1: start on fran
826 t0^ Add file delta (base) 905 t0^ Add file delta (base)
827 906
828 $ hg topics --age 907 $ hg topics --age
829 * changewut (1970-01-01) 908 * changewut (1970-01-01 by test)
830 909
831 $ cd .. 910 $ cd ..
832 911
833 Testing the new config knob to forbid untopiced commit 912 Testing the new config knob to forbid untopiced commit
834 ====================================================== 913 ======================================================
862 tag: tip 941 tag: tip
863 user: test 942 user: test
864 date: Thu Jan 01 00:00:00 1970 +0000 943 date: Thu Jan 01 00:00:00 1970 +0000
865 summary: added a 944 summary: added a
866 945
946 Testing the --age flag for `hg topics`
947 ======================================
948
867 $ hg topic topic1970 --rev 0 949 $ hg topic topic1970 --rev 0
868 switching to topic topic1970 950 switching to topic topic1970
869 changed topic on 1 changes 951 changed topic on 1 changes
952
870 $ hg add b 953 $ hg add b
871 $ hg topic topic1990 954 $ hg topic topic1990
872 $ hg ci -m "Added b" --config devel.default-date="631152000 0" 955 $ hg ci -m "Added b" --config devel.default-date="631152000 0" --user "foo"
956 active topic 'topic1990' grew its first changeset
873 $ hg add c 957 $ hg add c
874 $ hg topic topic2010 958 $ hg topic topic2010
875 $ hg ci -m "Added c" --config devel.default-date="1262304000 0" 959 $ hg ci -m "Added c" --config devel.default-date="1262304000 0" --user "bar"
876 $ hg log 960 active topic 'topic2010' grew its first changeset
877 changeset: 3:9048b194797d 961
878 tag: tip 962 $ hg log -G
879 topic: topic2010 963 @ changeset: 3:76b16af75125
880 user: test 964 | tag: tip
881 date: Fri Jan 01 00:00:00 2010 +0000 965 | topic: topic2010
882 summary: Added c 966 | user: bar
883 967 | date: Fri Jan 01 00:00:00 2010 +0000
884 changeset: 2:186d493c7f8d 968 | summary: Added c
885 topic: topic1990 969 |
886 user: test 970 o changeset: 2:bba5bde53608
887 date: Mon Jan 01 00:00:00 1990 +0000 971 | topic: topic1990
888 summary: Added b 972 | user: foo
889 973 | date: Mon Jan 01 00:00:00 1990 +0000
890 changeset: 1:e5a30a141954 974 | summary: Added b
891 topic: topic1970 975 |
892 parent: -1:000000000000 976 o changeset: 1:e5a30a141954
893 user: test 977 topic: topic1970
894 date: Thu Jan 01 00:00:00 1970 +0000 978 parent: -1:000000000000
895 summary: added a 979 user: test
980 date: Thu Jan 01 00:00:00 1970 +0000
981 summary: added a
896 982
897 $ hg topics 983 $ hg topics
898 topic1970 984 topic1970
899 topic1990 985 topic1990
900 * topic2010 986 * topic2010
987
901 $ hg topics --age 988 $ hg topics --age
902 * topic2010 (2010-01-01) 989 * topic2010 (2010-01-01 by bar)
903 topic1990 (1990-01-01) 990 topic1990 (1990-01-01 by foo)
904 topic1970 (1970-01-01) 991 topic1970 (1970-01-01 by test)
992
905 $ hg up topic1970 993 $ hg up topic1970
906 switching to topic topic1970 994 switching to topic topic1970
907 0 files updated, 0 files merged, 2 files removed, 0 files unresolved 995 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
996
908 $ hg topics --age 997 $ hg topics --age
909 topic2010 (2010-01-01) 998 topic2010 (2010-01-01 by bar)
910 topic1990 (1990-01-01) 999 topic1990 (1990-01-01 by foo)
911 * topic1970 (1970-01-01) 1000 * topic1970 (1970-01-01 by test)
912 1001
1002 $ hg topics --age random
1003 abort: cannot use --age while setting a topic
1004 [255]
913 $ cd .. 1005 $ cd ..