Mercurial > evolve
annotate tests/test-single-head-obsolescence-named-branch-A2.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 | b20d04641c0f |
children | 35e769c9604f 144d10e74757 |
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 ========================================= |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
3 Testing single head enforcement: Case A-2 |
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 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
6 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
|
7 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
|
8 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
|
9 branch. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
10 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
11 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
|
12 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
13 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
|
14 TestCase 2: A branch is split in two, effectively creating two heads |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
15 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
16 .. old-state: |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
17 .. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
18 .. * 2 changeset changeset on branch default |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
19 .. * 2 changeset changeset on branch Z on top of them. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
20 .. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
21 .. new-state: |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
22 .. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
23 .. * 2 changeset changeset on branch Z at the same location |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
24 .. * 1 changeset changeset on branch default unchanged |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
25 .. * 1 changeset changeset on branch default superceeding the other ones |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
26 .. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
27 .. expected-result: |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
28 .. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
29 .. * two heads detected |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
30 .. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
31 .. graph-summary: |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
32 .. |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
33 .. D ● (branch Z) |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
34 .. | |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
35 .. C ● (branch Z) |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
36 .. | |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
37 .. B ø⇠◔ B' |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
38 .. | | |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
39 .. A ● | |
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 |
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/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
|
44 $ . $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
|
45 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
46 Test setup |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
47 ---------- |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
48 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
49 $ mkdir A2 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
50 $ cd A2 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
51 $ 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
|
52 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
|
53 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
|
54 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
|
55 $ cd client |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
56 $ mkcommit B0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
57 $ hg branch Z |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
58 marked working directory as branch Z |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
59 (branches are permanent and global, did you want a bookmark?) |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
60 $ mkcommit C0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
61 $ mkcommit D0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
62 $ hg push --new-branch |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
63 pushing to $TESTTMP/A2/server |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
64 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
|
65 adding changesets |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
66 adding manifests |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
67 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
|
68 added 3 changesets with 3 changes to 3 files |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
69 $ hg up 0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
70 0 files updated, 0 files merged, 4 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
|
71 $ mkcommit B1 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
72 created new head |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
73 (consider using topic for lightweight branches. See 'hg help topic') |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
74 $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"` |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
75 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
|
76 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
|
77 2 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
|
78 $ hg log -G --hidden |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
79 @ 25c56d33e4c4 [default] (draft): B1 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
80 | |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
81 | * cdf1dbb37a67 [Z] (draft): D0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
82 | | |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
83 | * 3213e3e16c67 [Z] (draft): C0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
84 | | |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
85 | x d73caddc5533 [default] (draft): B0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
86 | | |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
87 | o 8aaa48160adc [default] (draft): A0 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
88 |/ |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
89 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
|
90 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
91 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
92 Actual testing |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
93 -------------- |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
94 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
95 (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
|
96 |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
97 $ hg push -r 'desc("B1")' --force |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
98 pushing to $TESTTMP/A2/server |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
99 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
|
100 adding changesets |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
101 adding manifests |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
102 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
|
103 transaction abort! |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
104 rollback completed |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
105 abort: rejecting multiple heads on branch "default" |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
106 (2 heads: 8aaa48160adc 25c56d33e4c4) |
b20d04641c0f
head-checking: ignore obsolete section when checking for single heads
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
diff
changeset
|
107 [255] |