annotate tests/test-topic-fold.t @ 5917:94aed9c7ce69 stable

next: refactor two if blocks into an if-elif block We already checked the value of `needevolve and opts['evolve']` in the first if block above. In the first one it need to be True, in the second it needs to be False for the statements to execute. Since not(a or b) = not a and not b, we can join the second if block to the first one with an elif while dropping the explicit check. For me, this works better, because we're doing the same thing in both of these blocks (checking if working copy is dirty or not).
author Anton Shestakov <av6@dwimlabs.net>
date Sat, 15 May 2021 20:40:19 +0800
parents a1dad44fe3da
children 656edde3a8ce
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
1 test of the fold command
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
2 ------------------------
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
3
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
4 $ cat >> $HGRCPATH <<EOF
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
5 > [ui]
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
6 > interactive = true
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
7 > [extensions]
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
8 > EOF
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
9 $ echo "topic=$(echo $(dirname $TESTDIR))/hgext3rd/topic/" >> $HGRCPATH
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
10 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
11 $ mkcommit() {
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
12 > echo "$1" > "$1"
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
13 > hg add "$1"
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
14 > hg ci -m "add $1" $2 $3
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
15 > }
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
16 $ logtopic() {
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
17 > hg log -G -T "{rev}:{node}\ntopics: {topics}"
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
18 > }
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
19
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
20 Check that fold keep the topic if all revisions have the topic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
21 --------------------------------------------------------------
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
22
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
23 $ hg init testfold
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
24 $ cd testfold
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
25 $ mkcommit ROOT
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
26 $ hg topic myfeature
2985
f63c97c01f92 topics/ui: signal when the topics command creates a new (empty) topic
Aurélien Campéas
parents: 2984
diff changeset
27 marked working directory as topic: myfeature
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
28 $ mkcommit feature1
2988
62201935e1a7 topics/ui: detect and signal when an empty changeset becomes non-empty
Aurélien Campéas
parents: 2986
diff changeset
29 active topic 'myfeature' grew its first changeset
3769
1bc4b0807c37 topic: display a hint pointing at help when a topic becomes non-empty
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 3397
diff changeset
30 (see 'hg help topics' for more information)
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
31 $ mkcommit feature2
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
32 $ logtopic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
33 @ 2:d76a6166b18c835be9a487c5e21c7d260f0a1676
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
34 | topics: myfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
35 o 1:39e7a938055e87615edf675c24a10997ff05bb06
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
36 | topics: myfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
37 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
38 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
39 $ hg fold --exact -r "(tip~1)::" -m "folded"
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
40 2 changesets folded
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
41 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
42 $ hg stack
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
43 ### topic: myfeature
2997
a61634f52742 topic: try to clarify the "branch" part in stack
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2988
diff changeset
44 ### target: default (branch)
4067
fb4801478d5d stack: display 's#' instead of 't#' and 'b#'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3769
diff changeset
45 s1@ folded (current)
fb4801478d5d stack: display 's#' instead of 't#' and 'b#'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 3769
diff changeset
46 s0^ add ROOT (base)
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
47 $ logtopic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
48 @ 3:4fd43e5bdc443dc8489edffac19bd8f93ccf1a5c
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
49 | topics: myfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
50 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
51 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
52 $ hg summary
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
53 parent: 3:4fd43e5bdc44 tip
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
54 folded
5685
7ee15bf011d6 topic: wrap branch call during summary
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4067
diff changeset
55 branch: default:myfeature
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
56 commit: (clean)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
57 update: (current)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
58 phases: 2 draft
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
59 topic: myfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
60
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
61 Check that fold dismis the topic if not all revisions have the topic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
62 --------------------------------------------------------------------
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
63
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
64 (I'm not sure this behavior make senses, but now it is tested)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
65
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
66 $ hg topic --clear
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
67 $ mkcommit feature3
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
68 created new head
3397
f7129e3d5a38 topic: suggest using topic when user creates a new head on branch
Pulkit Goyal <7895pulkit@gmail.com>
parents: 2997
diff changeset
69 (consider using topic for lightweight branches. See 'hg help topic')
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
70 $ hg topic myotherfeature
2985
f63c97c01f92 topics/ui: signal when the topics command creates a new (empty) topic
Aurélien Campéas
parents: 2984
diff changeset
71 marked working directory as topic: myotherfeature
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
72 $ mkcommit feature4
2988
62201935e1a7 topics/ui: detect and signal when an empty changeset becomes non-empty
Aurélien Campéas
parents: 2986
diff changeset
73 active topic 'myotherfeature' grew its first changeset
3769
1bc4b0807c37 topic: display a hint pointing at help when a topic becomes non-empty
Denis Laxalde <denis.laxalde@logilab.fr>
parents: 3397
diff changeset
74 (see 'hg help topics' for more information)
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
75 $ logtopic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
76 @ 5:5ded4d6d578c37f339b0716de2e46e12ece7cbde
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
77 | topics: myotherfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
78 o 4:bdf6950b9b5b7c6b377c8132667c73ec86d5734f
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
79 | topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
80 o 3:4fd43e5bdc443dc8489edffac19bd8f93ccf1a5c
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
81 | topics: myfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
82 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
83 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
84 $ hg fold --exact -r "(tip~1)::" -m "folded 2"
2986
4746b92cc1f8 topics/ui: signal when an operation entails voiding a topic
Aurélien Campéas
parents: 2985
diff changeset
85 active topic 'myotherfeature' is now empty
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
86 2 changesets folded
2984
30f6030dca8f topics: signal to the end user when a topic has been forgotten
Aurélien Campéas
parents: 2776
diff changeset
87 clearing empty topic "myotherfeature"
2666
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
88 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
89 $ logtopic
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
90 @ 6:03da8f7238e9a4d708d6b8af402c91c68f271477
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
91 | topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
92 o 3:4fd43e5bdc443dc8489edffac19bd8f93ccf1a5c
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
93 | topics: myfeature
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
94 o 0:3e7df3b3b17c6deb4a1c70e790782fdf17af96a7
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
95 topics:
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
96 $ hg summary
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
97 parent: 6:03da8f7238e9 tip
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
98 folded 2
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
99 branch: default
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
100 commit: (clean)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
101 update: (current)
2d828f448081 topic: add tests for fold behavior with topics
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
102 phases: 3 draft