|
1 ========================================= |
|
2 Testing single head enforcement: Case A-2 |
|
3 ========================================= |
|
4 |
|
5 A repository is set to only accept a single head per name (typically named |
|
6 branch). However, obsolete changesets can make this enforcement more |
|
7 complicated, because they can be kept visible by other changeset on other |
|
8 branch. |
|
9 |
|
10 This case is part of a series of tests checking this behavior. |
|
11 |
|
12 Category A: Involving obsolescence |
|
13 TestCase 2: A branch is split in two, effectively creating two heads |
|
14 |
|
15 .. old-state: |
|
16 .. |
|
17 .. * 2 changesets on branch default |
|
18 .. * 2 changesets on branch Z on top of them |
|
19 .. |
|
20 .. new-state: |
|
21 .. |
|
22 .. * 2 changesets on branch Z at the same location |
|
23 .. * 1 changeset on branch default unchanged |
|
24 .. * 1 changeset on branch default superseding the other ones |
|
25 .. |
|
26 .. expected-result: |
|
27 .. |
|
28 .. * two heads detected |
|
29 .. |
|
30 .. graph-summary: |
|
31 .. |
|
32 .. D ● (branch Z) |
|
33 .. | |
|
34 .. C ● (branch Z) |
|
35 .. | |
|
36 .. B ø⇠◔ B' |
|
37 .. | | |
|
38 .. A ● | |
|
39 .. |/ |
|
40 .. ● |
|
41 |
|
42 $ . $TESTDIR/testlib/push-checkheads-util.sh |
|
43 |
|
44 $ cat >> $HGRCPATH << EOF |
|
45 > [command-templates] |
|
46 > log = "{node|short} [{branch}] ({phase}): {desc}\n" |
|
47 > EOF |
|
48 |
|
49 Test setup |
|
50 ---------- |
|
51 |
|
52 $ mkdir A2 |
|
53 $ cd A2 |
|
54 $ setuprepos single-head |
|
55 creating basic server and client repo |
|
56 updating to branch default |
|
57 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
58 $ cd client |
|
59 $ mkcommit B0 |
|
60 $ hg branch Z |
|
61 marked working directory as branch Z |
|
62 (branches are permanent and global, did you want a bookmark?) |
|
63 $ mkcommit C0 |
|
64 $ mkcommit D0 |
|
65 $ hg push --new-branch |
|
66 pushing to $TESTTMP/A2/server |
|
67 searching for changes |
|
68 adding changesets |
|
69 adding manifests |
|
70 adding file changes |
|
71 added 3 changesets with 3 changes to 3 files |
|
72 $ hg up 0 |
|
73 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
74 $ mkcommit B1 |
|
75 created new head |
|
76 $ hg debugobsolete `getid "desc(B0)"` `getid "desc(B1)"` |
|
77 1 new obsolescence markers |
|
78 obsoleted 1 changesets |
|
79 2 new orphan changesets |
|
80 $ hg heads |
|
81 25c56d33e4c4 [default] (draft): B1 |
|
82 cdf1dbb37a67 [Z] (draft): D0 |
|
83 8aaa48160adc [default] (draft): A0 |
|
84 $ hg log -G --hidden |
|
85 @ 25c56d33e4c4 [default] (draft): B1 |
|
86 | |
|
87 | * cdf1dbb37a67 [Z] (draft): D0 |
|
88 | | |
|
89 | * 3213e3e16c67 [Z] (draft): C0 |
|
90 | | |
|
91 | x d73caddc5533 [default] (draft): B0 |
|
92 | | |
|
93 | o 8aaa48160adc [default] (draft): A0 |
|
94 |/ |
|
95 o 1e4be0697311 [default] (public): root |
|
96 |
|
97 |
|
98 Actual testing |
|
99 -------------- |
|
100 |
|
101 (force push to make sure we get the changeset on the remote) |
|
102 |
|
103 $ hg push -r 'desc("B1")' --force |
|
104 pushing to $TESTTMP/A2/server |
|
105 searching for changes |
|
106 adding changesets |
|
107 adding manifests |
|
108 adding file changes |
|
109 transaction abort! |
|
110 rollback completed |
|
111 abort: rejecting multiple heads on branch "default" |
|
112 (2 heads: 8aaa48160adc 25c56d33e4c4) |
|
113 [255] |