annotate tests/test-single-head-obsolescence-topic-B4.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 fa1324e58fcf
children 35e769c9604f 8cc7732a29bf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
1 =========================================
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
2 Testing single head enforcement: Case A-4
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
3 =========================================
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
4
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
5 A repository is set to only accept a single head per name (typically named
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
6 branch). However, obsolete changesets can make this enforcement more
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
7 complicated, because they can be kept visible by other changeset on other
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
8 branch.
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
9
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
10 This case is part of a series of tests checking this behavior.
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
11
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
12 Category A: Involving obsolescence
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
13 TestCase 4: Partial rewrite of a branch to dis-interleave it
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
14
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
15 .. old-state:
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
16 ..
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
17 .. * 2 changeset changeset on topic X
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
18 .. * 2 changeset changeset on topic Y interleaved with the other one
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
19 ..
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
20 .. new-state:
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
21 ..
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
22 .. * 2 changeset changeset on topic Y at the same location
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
23 .. * 1 changeset on topic X untouched (the lower one)
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
24 .. * 1 changeset on topic X moved on the other one
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
25 ..
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
26 .. expected-result:
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
27 ..
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
28 .. * only one head detected
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
29 ..
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
30 .. graph-summary:
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
31 ..
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
32 .. D ● (topic-Y)
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
33 .. |
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
34 .. C ø⇠◔ C' (topic-X)
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
35 .. | |
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
36 .. B ● | (topic-Y)
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
37 .. |/
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
38 .. A ● (topic-X)
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
39 .. |
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
40 .. ●
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
41
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
42 $ . $TESTDIR/testlib/topic_setup.sh
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
43 $ . $TESTDIR/testlib/push-checkheads-util.sh
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
44
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
45 Test setup
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
46 ----------
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
47
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
48 $ mkdir B4
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
49 $ cd B4
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
50 $ setuprepos single-head
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
51 creating basic server and client repo
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
52 updating to branch default
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
53 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
54 $ cd client
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
55 $ hg topic -r . topic-X
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
56 switching to topic topic-X
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
57 changed topic on 1 changesets to "topic-X"
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
58 $ hg strip --config extensions.strip= --hidden 'hidden()' --no-backup # clean old A0
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
59 $ hg topic topic-Y
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
60 $ mkcommit B0
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
61 active topic 'topic-Y' grew its first changeset
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
62 (see 'hg help topics' for more information)
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
63 $ hg topic topic-X
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
64 $ mkcommit C0
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
65 $ hg topic topic-Y
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
66 $ mkcommit D0
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
67 $ hg push --new-branch
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
68 pushing to $TESTTMP/B4/server
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
69 searching for changes
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
70 adding changesets
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
71 adding manifests
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
72 adding file changes
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
73 added 4 changesets with 3 changes to 4 files (+1 heads)
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
74 1 new obsolescence markers
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
75 obsoleted 1 changesets
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
76 $ hg up 'desc("A0")'
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
77 switching to topic topic-X
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
78 0 files updated, 0 files merged, 3 files removed, 0 files unresolved
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
79 $ hg topic topic-X
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
80 $ mkcommit C1
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
81 $ hg debugobsolete `getid "desc(C0)" ` `getid "desc(C1)"`
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
82 1 new obsolescence markers
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
83 obsoleted 1 changesets
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
84 1 new orphan changesets
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
85 $ hg log -G --hidden
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
86 @ b98a8bd4ca39 [default:topic-X] (draft): C1
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
87 |
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
88 | * 850d57e10bfe [default:topic-Y] (draft): D0
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
89 | |
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
90 | x fcdd583577e8 [default:topic-X] (draft): C0
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
91 | |
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
92 | o 030eec7a0fe2 [default:topic-Y] (draft): B0
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
93 |/
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
94 o 5a47a98cd8e5 [default:topic-X] (draft): A0
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
95 |
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
96 o 1e4be0697311 [default] (public): root
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
97
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
98
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
99 Actual testing
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
100 --------------
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
101
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
102 (force push to make sure we get the changeset on the remote)
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
103
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
104 $ hg push -r 'desc("C1")' --force
5229
fa1324e58fcf head-checking: also test single head enforcement with topic
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 5227
diff changeset
105 pushing to $TESTTMP/B4/server
5227
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
106 searching for changes
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
107 adding changesets
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
108 adding manifests
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
109 adding file changes
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
110 added 1 changesets with 1 changes to 1 files (+1 heads)
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
111 1 new obsolescence markers
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
112 obsoleted 1 changesets
b20d04641c0f head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff changeset
113 1 new orphan changesets