annotate tests/test-push-checkheads-unpushed-D6.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 f0d46ffbf1bb
children 73cb6cafc930 fc60328270ac
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
1 ====================================
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
2 Testing head checking code: Case D-6
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
3 ====================================
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
4
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
5 Mercurial checks for the introduction of new heads on push. Evolution comes
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
6 into play to detect if existing branches on the server are being replaced by
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
7 some of the new one we push.
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
8
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
9 This case is part of a series of tests checking this behavior.
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
10
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
11 Category D: remote head is "obs-affected" locally, but result is not part of the push
5053
196ed65594dc evolve: correct spelling of superseded everywhere else
Anton Shestakov <av6@dwimlabs.net>
parents: 4871
diff changeset
12 TestCase 6: single changeset, superseded then pruned (on a new changeset unpushed) changeset
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
13
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
14 This is a partial push variation of case B-6
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
15
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
16 .. old-state:
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
17 ..
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
18 .. * 1 changeset branch
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
19 ..
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
20 .. new-state:
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
21 ..
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
22 .. * old branch is rewritten onto another one,
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
23 .. * the new version is then pruned.
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
24 ..
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
25 .. expected-result:
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
26 ..
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
27 .. * push denied
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
28 ..
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
29 .. graph-summary:
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
30 ..
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
31 .. A ø⇠⊗ A'
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
32 .. | |
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
33 .. C ◔ | ○ B
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
34 .. \|/
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
35 .. ●
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
36
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
37 $ . $TESTDIR/testlib/push-checkheads-util.sh
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
38
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
39 Test setup
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
40 ----------
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
41
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
42 $ mkdir D6
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
43 $ cd D6
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
44 $ setuprepos
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
45 creating basic server and client repo
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
46 updating to branch default
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
47 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
48 $ cd client
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
49 $ hg up 0
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
50 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
51 $ mkcommit B0
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
52 created new head
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
53 $ mkcommit A1
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
54 $ hg up '0'
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
55 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
56 $ mkcommit C0
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
57 created new head
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
58 $ hg debugobsolete `getid "desc(A0)"` `getid "desc(A1)"`
4871
a8ff17479fb8 branching: preserve test change on stable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4860
diff changeset
59 1 new obsolescence markers
2754
21f06d932231 test: update test output to match b11e8c67fb0f
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2277
diff changeset
60 obsoleted 1 changesets
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
61 $ hg debugobsolete --record-parents `getid "desc(A1)"`
4871
a8ff17479fb8 branching: preserve test change on stable
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 4860
diff changeset
62 1 new obsolescence markers
2754
21f06d932231 test: update test output to match b11e8c67fb0f
Pierre-Yves David <pierre-yves.david@octobus.net>
parents: 2277
diff changeset
63 obsoleted 1 changesets
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
64 $ hg log -G --hidden
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
65 @ 0f88766e02d6 (draft): C0
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
66 |
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
67 | x ba93660aff8d (draft): A1
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
68 | |
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
69 | o 74ff5441d343 (draft): B0
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
70 |/
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
71 | x 8aaa48160adc (draft): A0
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
72 |/
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
73 o 1e4be0697311 (public): root
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
74
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
75
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
76 Actual testing
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
77 --------------
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
78
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
79 $ hg push --rev 'desc(C0)'
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
80 pushing to $TESTTMP/D6/server (glob)
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
81 searching for changes
5672
12c53d7122a7 tests: remove trailing "!" from abort messages
Anton Shestakov <av6@dwimlabs.net>
parents: 5053
diff changeset
82 abort: push creates new remote head 0f88766e02d6
2256
7ec214ea5d67 checkheahds: switch algorithm to use pushed markers instead
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
83 (merge or see 'hg help push' for details about pushing new heads)
5682
f0d46ffbf1bb tests: update exit code in case of push failing because it'd create new heads
Anton Shestakov <av6@dwimlabs.net>
parents: 5672
diff changeset
84 [20]
2277
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
85
61d885899466 checkheads: update tests to match the one in core
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents: 2256
diff changeset
86 $ cd ../..