Mercurial > hg
comparison tests/test-single-head.t @ 35185:66ecde8a704d
server: introduce a 'experimental.single-head-per-branch' option
When the option is set, the repository will reject any transaction adding
multiple heads to the same named branch.
For now we reject all scenario with multiple heads. One could imagine handling
closed branches differently. We prefer to keep things simple for now. The
feature might get extended later. Branch closing is not the best experience
Mercurial has to offer anyway.
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Thu, 16 Nov 2017 03:52:42 +0100 |
parents | |
children | 4441705b7111 |
comparison
equal
deleted
inserted
replaced
35184:bc775b8cc020 | 35185:66ecde8a704d |
---|---|
1 ===================== | |
2 Test workflow options | |
3 ===================== | |
4 | |
5 $ . "$TESTDIR/testlib/obsmarker-common.sh" | |
6 | |
7 Test single head enforcing - Setup | |
8 ============================================= | |
9 | |
10 $ cat << EOF >> $HGRCPATH | |
11 > [experimental] | |
12 > evolution = all | |
13 > EOF | |
14 $ hg init single-head-server | |
15 $ cd single-head-server | |
16 $ cat <<EOF >> .hg/hgrc | |
17 > [phases] | |
18 > publish = no | |
19 > [experimental] | |
20 > single-head-per-branch = yes | |
21 > EOF | |
22 $ mkcommit ROOT | |
23 $ mkcommit c_dA0 | |
24 $ cd .. | |
25 | |
26 $ hg clone single-head-server client | |
27 updating to branch default | |
28 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
29 | |
30 Test single head enforcing - with branch only | |
31 --------------------------------------------- | |
32 | |
33 $ cd client | |
34 | |
35 continuing the current defaultbranch | |
36 | |
37 $ mkcommit c_dB0 | |
38 $ hg push | |
39 pushing to $TESTTMP/single-head-server (glob) | |
40 searching for changes | |
41 adding changesets | |
42 adding manifests | |
43 adding file changes | |
44 added 1 changesets with 1 changes to 1 files | |
45 | |
46 creating a new branch | |
47 | |
48 $ hg up 'desc("ROOT")' | |
49 0 files updated, 0 files merged, 2 files removed, 0 files unresolved | |
50 $ hg branch branch_A | |
51 marked working directory as branch branch_A | |
52 (branches are permanent and global, did you want a bookmark?) | |
53 $ mkcommit c_aC0 | |
54 $ hg push --new-branch | |
55 pushing to $TESTTMP/single-head-server (glob) | |
56 searching for changes | |
57 adding changesets | |
58 adding manifests | |
59 adding file changes | |
60 added 1 changesets with 1 changes to 1 files (+1 heads) | |
61 | |
62 Create a new head on the default branch | |
63 | |
64 $ hg up 'desc("c_dA0")' | |
65 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
66 $ mkcommit c_dD0 | |
67 created new head | |
68 $ hg push -f | |
69 pushing to $TESTTMP/single-head-server (glob) | |
70 searching for changes | |
71 adding changesets | |
72 adding manifests | |
73 adding file changes | |
74 added 1 changesets with 1 changes to 1 files (+1 heads) | |
75 transaction abort! | |
76 rollback completed | |
77 abort: rejecting multiple heads on branch "default" | |
78 (2 heads: 286d02a6e2a2 9bf953aa81f6) | |
79 [255] | |
80 | |
81 remerge them | |
82 | |
83 $ hg merge | |
84 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
85 (branch merge, don't forget to commit) | |
86 $ mkcommit c_dE0 | |
87 $ hg push | |
88 pushing to $TESTTMP/single-head-server (glob) | |
89 searching for changes | |
90 adding changesets | |
91 adding manifests | |
92 adding file changes | |
93 added 2 changesets with 2 changes to 2 files | |
94 | |
95 Test single head enforcing - after rewrite | |
96 ------------------------------------------ | |
97 | |
98 $ mkcommit c_dF0 | |
99 $ hg push | |
100 pushing to $TESTTMP/single-head-server (glob) | |
101 searching for changes | |
102 adding changesets | |
103 adding manifests | |
104 adding file changes | |
105 added 1 changesets with 1 changes to 1 files | |
106 $ hg commit --amend -m c_dF1 | |
107 $ hg push | |
108 pushing to $TESTTMP/single-head-server (glob) | |
109 searching for changes | |
110 adding changesets | |
111 adding manifests | |
112 adding file changes | |
113 added 1 changesets with 0 changes to 1 files (+1 heads) | |
114 1 new obsolescence markers | |
115 obsoleted 1 changesets | |
116 | |
117 Check it does to interfer with strip | |
118 ------------------------------------ | |
119 | |
120 setup | |
121 | |
122 $ hg branch branch_A --force | |
123 marked working directory as branch branch_A | |
124 $ mkcommit c_aG0 | |
125 created new head | |
126 $ hg update 'desc("c_dF1")' | |
127 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
128 $ mkcommit c_dH0 | |
129 $ hg update 'desc("c_aG0")' | |
130 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
131 $ hg merge | |
132 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
133 (branch merge, don't forget to commit) | |
134 $ mkcommit c_aI0 | |
135 $ hg log -G | |
136 @ changeset: 10:49003e504178 | |
137 |\ branch: branch_A | |
138 | | tag: tip | |
139 | | parent: 8:a33fb808fb4b | |
140 | | parent: 3:840af1c6bc88 | |
141 | | user: test | |
142 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
143 | | summary: c_aI0 | |
144 | | | |
145 | | o changeset: 9:fe47ea669cea | |
146 | | | parent: 7:99a2dc242c5d | |
147 | | | user: test | |
148 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
149 | | | summary: c_dH0 | |
150 | | | | |
151 | o | changeset: 8:a33fb808fb4b | |
152 | |/ branch: branch_A | |
153 | | user: test | |
154 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
155 | | summary: c_aG0 | |
156 | | | |
157 | o changeset: 7:99a2dc242c5d | |
158 | | parent: 5:6ed1df20edb1 | |
159 | | user: test | |
160 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
161 | | summary: c_dF1 | |
162 | | | |
163 | o changeset: 5:6ed1df20edb1 | |
164 | |\ parent: 4:9bf953aa81f6 | |
165 | | | parent: 2:286d02a6e2a2 | |
166 | | | user: test | |
167 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
168 | | | summary: c_dE0 | |
169 | | | | |
170 | | o changeset: 4:9bf953aa81f6 | |
171 | | | parent: 1:134bc3852ad2 | |
172 | | | user: test | |
173 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
174 | | | summary: c_dD0 | |
175 | | | | |
176 o | | changeset: 3:840af1c6bc88 | |
177 | | | branch: branch_A | |
178 | | | parent: 0:ea207398892e | |
179 | | | user: test | |
180 | | | date: Thu Jan 01 00:00:00 1970 +0000 | |
181 | | | summary: c_aC0 | |
182 | | | | |
183 | o | changeset: 2:286d02a6e2a2 | |
184 | |/ user: test | |
185 | | date: Thu Jan 01 00:00:00 1970 +0000 | |
186 | | summary: c_dB0 | |
187 | | | |
188 | o changeset: 1:134bc3852ad2 | |
189 |/ user: test | |
190 | date: Thu Jan 01 00:00:00 1970 +0000 | |
191 | summary: c_dA0 | |
192 | | |
193 o changeset: 0:ea207398892e | |
194 user: test | |
195 date: Thu Jan 01 00:00:00 1970 +0000 | |
196 summary: ROOT | |
197 | |
198 | |
199 actual stripping | |
200 | |
201 $ hg strip --config extensions.strip= --rev 'desc("c_dH0")' | |
202 saved backup bundle to $TESTTMP/client/.hg/strip-backup/fe47ea669cea-a41bf5a9-backup.hg (glob) | |
203 |