annotate tests/test-push-checkheads-superceed-A3.t @ 32924:f044295cdb7a

repair: move check for existing transaction earlier Several benefits: * Gets close the comment describing it * Splits off unrelated comment about "backup" argument * Error checking is customarily done early * If we added an early return to the method, it would still consistently fail if there was an existing transaction (so we would find and fix that case quickly) One test needs updating with for this change, because we no longer create the backup bundle before we fail. I don't see much reason to create that backup bundle. If some command was adding content and then trying to strip it as well within the transaction, we would have a backup for the user, but the risk of that not being discovered in development seems very small.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 19 Jun 2017 13:18:00 -0700
parents e0b6421b2fc5
children 53b3a1968aa6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
31976
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
1 ====================================
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
2 Testing head checking code: Case A-3
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
3 ====================================
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
4
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
5 Mercurial checks for the introduction of new heads on push. Evolution comes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
6 into play to detect if existing branches on the server are being replaced by
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
7 some of the new one we push.
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
8
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
9 This case is part of a series of tests checking this behavior.
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
10
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
11 Category A: simple case involving a branch being superceeded by another.
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
12 TestCase 3: multi-changeset branch with reordering
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
13
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
14 Push should be allowed
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
15 .. old-state:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
16 ..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
17 .. * 2 changeset branch
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
18 ..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
19 .. new-state:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
20 ..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
21 .. * 2 changeset branch succeeding the old one with reordering
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
22 ..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
23 .. expected-result:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
24 ..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
25 .. * push allowed
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
26 ..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
27 .. graph-summary:
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
28 ..
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
29 .. B ø⇠⇠
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
30 .. | ⇡
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
31 .. A ø⇠⇠⇠○ A'
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
32 .. | ⇡/
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
33 .. | ○ B'
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
34 .. |/
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
35 .. ●
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
36
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
37 $ . $TESTDIR/testlib/push-checkheads-util.sh
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
38
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
39 Test setup
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
40 ----------
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
41
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
42 $ mkdir A3
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
43 $ cd A3
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
44 $ setuprepos
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
45 creating basic server and client repo
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
46 updating to branch default
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
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
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
48 $ cd server
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
49 $ mkcommit B0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
50 $ cd ../client
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
51 $ hg pull
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
52 pulling from $TESTTMP/A3/server (glob)
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
53 searching for changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
54 adding changesets
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
55 adding manifests
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
56 adding file changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
57 added 1 changesets with 1 changes to 1 files
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
58 (run 'hg update' to get a working copy)
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
59 $ hg up 0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
60 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
61 $ mkcommit B1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
62 created new head
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
63 $ mkcommit A1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
64 $ hg debugobsolete `getid "desc(A0)" ` `getid "desc(A1)"`
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
65 $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"`
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
66 $ hg log -G --hidden
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
67 @ c1c7524e9488 (draft): A1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
68 |
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
69 o 25c56d33e4c4 (draft): B1
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
70 |
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
71 | x d73caddc5533 (draft): B0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
72 | |
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
73 | x 8aaa48160adc (draft): A0
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
74 |/
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
75 o 1e4be0697311 (public): root
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
76
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
77
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
78 Actual testing
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
79 --------------
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
80
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
81 $ hg push
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
82 pushing to $TESTTMP/A3/server (glob)
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
83 searching for changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
84 adding changesets
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
85 adding manifests
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
86 adding file changes
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
87 added 2 changesets with 2 changes to 2 files (+1 heads)
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
88 2 new obsolescence markers
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
89
e0b6421b2fc5 obsolescence: add test for the "branch replacement" logic during push, case A3
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
diff changeset
90 $ cd ../..