comparison tests/test-push-checkheads-unpushed-D5.t @ 32017:9f7ba0daada1

obsolescence: add test for the "branch replacement" logic during push, case D5 Mercurial checks for the introduction of new heads on push. Evolution comes into play to detect if existing branches on the server are being replaced by some of the new one we push. This changeset adds test for the improved "branch replacement" logic introduce in an earlier commits. This tests initially lived in the evolve extensions. Since we now have the code handling this logic in core, it make sense to have the tests in core too. See inline documentation for details about the test case added in this changeset.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Sat, 15 Apr 2017 02:54:27 +0200
parents
children 53b3a1968aa6
comparison
equal deleted inserted replaced
32016:43c91eb53806 32017:9f7ba0daada1
1 ====================================
2 Testing head checking code: Case D-5
3 ====================================
4
5 Mercurial checks for the introduction of new heads on push. Evolution comes
6 into play to detect if existing branches on the server are being replaced by
7 some of the new one we push.
8
9 This case is part of a series of tests checking this behavior.
10
11 Category D: remote head is "obs-affected" locally, but result is not part of the push
12 TestCase 5: multi-changeset branch, split on multiple other, (head on its own new branch)
13
14 .. old-state:
15 ..
16 .. * 2 branch (1 changeset, and 2 changesets)
17 ..
18 .. new-state:
19 ..
20 .. * 1 new branch superceeding the head of the old-2-changesets-branch,
21 .. * 1 new changesets on the old-1-changeset-branch superceeding the base of the other
22 ..
23 .. expected-result:
24 ..
25 .. * push the new branch only -> push denied
26 .. * push the existing branch only -> push allowed
27 .. /!\ This push create unstability/orphaning on the other hand and we should
28 .. probably detect/warn agains that.
29 ..
30 .. graph-summary:
31 ..
32 .. B ø⇠◔ B'
33 .. | |
34 .. A'◔⇢ø |
35 .. | |/
36 .. C ● |
37 .. \|
38 .. ●
39
40 $ . $TESTDIR/testlib/push-checkheads-util.sh
41
42 Test setup
43 ----------
44
45 $ mkdir D5
46 $ cd D5
47 $ setuprepos
48 creating basic server and client repo
49 updating to branch default
50 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
51 $ cd server
52 $ mkcommit B0
53 $ hg up 0
54 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
55 $ mkcommit C0
56 created new head
57 $ cd ../client
58 $ hg pull
59 pulling from $TESTTMP/D5/server (glob)
60 searching for changes
61 adding changesets
62 adding manifests
63 adding file changes
64 added 2 changesets with 2 changes to 2 files (+1 heads)
65 (run 'hg heads' to see heads, 'hg merge' to merge)
66 $ hg up 'desc(C0)'
67 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
68 $ mkcommit A1
69 $ hg up 0
70 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
71 $ mkcommit B1
72 created new head
73 $ hg debugobsolete `getid "desc(A0)" ` `getid "desc(A1)"`
74 $ hg debugobsolete `getid "desc(B0)" ` `getid "desc(B1)"`
75 $ hg log -G --hidden
76 @ 25c56d33e4c4 (draft): B1
77 |
78 | o a0802eb7fc1b (draft): A1
79 | |
80 | o 0f88766e02d6 (draft): C0
81 |/
82 | x d73caddc5533 (draft): B0
83 | |
84 | x 8aaa48160adc (draft): A0
85 |/
86 o 1e4be0697311 (public): root
87
88
89 Actual testing
90 --------------
91
92 $ hg push --rev 'desc(B1)'
93 pushing to $TESTTMP/D5/server (glob)
94 searching for changes
95 abort: push creates new remote head 25c56d33e4c4!
96 (merge or see 'hg help push' for details about pushing new heads)
97 [255]
98 $ hg push --rev 'desc(A1)'
99 pushing to $TESTTMP/D5/server (glob)
100 searching for changes
101 adding changesets
102 adding manifests
103 adding file changes
104 added 1 changesets with 1 changes to 1 files
105 1 new obsolescence markers
106
107 $ cd ../..