comparison tests/test-push-checkheads-unpushed-D2.t @ 31987:8823daaf4665

obsolescence: add test for the "branch replacement" logic during push, case D2 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. The current code for this logic is very basic (eg: issue4354) and was poorly tested. We have a better implementation coming in the evolve extension fixing these issues and with more serious tests coverage. In the process of upstreaming this improved logic, we start with adding the test case that are already passing with the current implementation. Once they are all in, we'll upstream the better implementation and the extra test cases. See inline documentation for details about the test case added in this changeset.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Thu, 13 Apr 2017 16:27:42 +0200
parents
children b11e8c67fb0f
comparison
equal deleted inserted replaced
31986:f4d5d4f7aee1 31987:8823daaf4665
1 ====================================
2 Testing head checking code: Case D-2
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 1: remote branch has 2 changes, head is pruned, other is rewritten but result is not pushed
13
14 .. old-state:
15 ..
16 .. * 1 changeset branch
17 ..
18 .. new-state:
19 ..
20 .. * old head is pruned
21 .. * 1 new branch succeeding to the other changeset in the old branch
22 .. * 1 new unrelated branch
23 ..
24 .. expected-result:
25 ..
26 .. * push allowed
27 .. * pushing only the unrelated branch: denied
28 ..
29 .. graph-summary:
30 ..
31 .. B ⊗
32 .. |
33 .. A ø⇠○ A'
34 .. |/
35 .. | ◔ C
36 .. |/
37 .. ●
38
39 $ . $TESTDIR/testlib/push-checkheads-util.sh
40
41 Test setup
42 ----------
43
44 $ mkdir D2
45 $ cd D2
46 $ setuprepos
47 creating basic server and client repo
48 updating to branch default
49 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
50 $ cd server
51 $ mkcommit B0
52 $ cd ../client
53 $ hg pull
54 pulling from $TESTTMP/D2/server (glob)
55 searching for changes
56 adding changesets
57 adding manifests
58 adding file changes
59 added 1 changesets with 1 changes to 1 files
60 (run 'hg update' to get a working copy)
61 $ hg up 0
62 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
63 $ mkcommit A1
64 created new head
65 $ hg debugobsolete `getid "desc(A0)" ` `getid "desc(A1)"`
66 $ hg debugobsolete --record-parents `getid "desc(B0)"`
67 $ hg up 0
68 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
69 $ mkcommit C0
70 created new head
71 $ hg log -G --hidden
72 @ 0f88766e02d6 (draft): C0
73 |
74 | o f6082bc4ffef (draft): A1
75 |/
76 | x d73caddc5533 (draft): B0
77 | |
78 | x 8aaa48160adc (draft): A0
79 |/
80 o 1e4be0697311 (public): root
81
82
83 Actual testing
84 --------------
85
86 $ hg push --rev 'desc(C0)'
87 pushing to $TESTTMP/D2/server (glob)
88 searching for changes
89 abort: push creates new remote head 0f88766e02d6!
90 (merge or see 'hg help push' for details about pushing new heads)
91 [255]
92
93 $ cd ../..