Mercurial > hg
annotate tests/test-newbranch.t @ 12279:28e2e3804f2e
combine tests
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 14 Sep 2010 12:20:51 +0200 |
parents | tests/test-newbranch@4c94b6d0fb1c |
children | 4134686b83e1 |
rev | line source |
---|---|
12279 | 1 $ branchcache=.hg/branchheads.cache |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
2 |
12279 | 3 $ hg init t |
4 $ cd t | |
6160
3ee3bc5d06c5
tests: hide the name of the branch cache file
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
5988
diff
changeset
|
5 |
12279 | 6 $ hg branches |
7 $ echo foo > a | |
8 $ hg add a | |
9 $ hg ci -m "initial" | |
10 $ hg branch foo | |
11 marked working directory as branch foo | |
12 $ hg branch | |
13 foo | |
14 $ hg ci -m "add branch name" | |
15 $ hg branch bar | |
16 marked working directory as branch bar | |
17 $ hg ci -m "change branch name" | |
18 | |
19 Branch shadowing: | |
20 | |
21 $ hg branch default | |
22 abort: a branch of the same name already exists (use 'hg update' to switch to it) | |
23 | |
24 $ hg branch -f default | |
25 marked working directory as branch default | |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
26 |
12279 | 27 $ hg ci -m "clear branch name" |
28 created new head | |
29 | |
30 There should be only one default branch head | |
31 | |
32 $ hg heads . | |
33 changeset: 3:9d567d0b51f9 | |
34 tag: tip | |
35 user: test | |
36 date: Thu Jan 01 00:00:00 1970 +0000 | |
37 summary: clear branch name | |
38 | |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
39 |
12279 | 40 $ hg co foo |
41 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
42 $ hg branch | |
43 foo | |
44 $ echo bleah > a | |
45 $ hg ci -m "modify a branch" | |
46 | |
47 $ hg merge default | |
48 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
49 (branch merge, don't forget to commit) | |
50 | |
51 $ hg branch | |
52 foo | |
53 $ hg ci -m "merge" | |
8954
e67e5b60e55f
Branch heads should not include "heads" that are ancestors of other heads.
Brendan Cully <brendan@kublai.com>
parents:
7654
diff
changeset
|
54 |
12279 | 55 $ hg log |
56 changeset: 5:dc140083783b | |
57 branch: foo | |
58 tag: tip | |
59 parent: 4:98d14f698afe | |
60 parent: 3:9d567d0b51f9 | |
61 user: test | |
62 date: Thu Jan 01 00:00:00 1970 +0000 | |
63 summary: merge | |
64 | |
65 changeset: 4:98d14f698afe | |
66 branch: foo | |
67 parent: 1:0079f24813e2 | |
68 user: test | |
69 date: Thu Jan 01 00:00:00 1970 +0000 | |
70 summary: modify a branch | |
71 | |
72 changeset: 3:9d567d0b51f9 | |
73 user: test | |
74 date: Thu Jan 01 00:00:00 1970 +0000 | |
75 summary: clear branch name | |
76 | |
77 changeset: 2:ed2bbf4e0102 | |
78 branch: bar | |
79 user: test | |
80 date: Thu Jan 01 00:00:00 1970 +0000 | |
81 summary: change branch name | |
82 | |
83 changeset: 1:0079f24813e2 | |
84 branch: foo | |
85 user: test | |
86 date: Thu Jan 01 00:00:00 1970 +0000 | |
87 summary: add branch name | |
88 | |
89 changeset: 0:db01e8ea3388 | |
90 user: test | |
91 date: Thu Jan 01 00:00:00 1970 +0000 | |
92 summary: initial | |
93 | |
94 $ hg branches | |
95 foo 5:dc140083783b | |
96 default 3:9d567d0b51f9 (inactive) | |
97 bar 2:ed2bbf4e0102 (inactive) | |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
98 |
12279 | 99 $ hg branches -q |
100 foo | |
101 default | |
102 bar | |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
103 |
12279 | 104 Test for invalid branch cache: |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
105 |
12279 | 106 $ hg rollback |
107 rolling back to revision 4 (undo commit) | |
108 | |
109 $ cp $branchcache .hg/bc-invalid | |
110 | |
111 $ hg log -r foo | |
112 changeset: 4:98d14f698afe | |
113 branch: foo | |
114 tag: tip | |
115 parent: 1:0079f24813e2 | |
116 user: test | |
117 date: Thu Jan 01 00:00:00 1970 +0000 | |
118 summary: modify a branch | |
119 | |
120 $ cp .hg/bc-invalid $branchcache | |
4175
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
121 |
12279 | 122 $ hg --debug log -r foo |
123 invalidating branch cache (tip differs) | |
124 changeset: 4:98d14f698afeaff8cb612dcf215ce95e639effc3 | |
125 branch: foo | |
126 tag: tip | |
127 parent: 1:0079f24813e2b73a891577c243684c5066347bc8 | |
128 parent: -1:0000000000000000000000000000000000000000 | |
129 manifest: 4:d01b250baaa05909152f7ae07d7a649deea0df9a | |
130 user: test | |
131 date: Thu Jan 01 00:00:00 1970 +0000 | |
132 files: a | |
133 extra: branch=foo | |
134 description: | |
135 modify a branch | |
136 | |
137 | |
138 $ rm $branchcache | |
139 $ echo corrupted > $branchcache | |
140 | |
141 $ hg log -qr foo | |
142 4:98d14f698afe | |
143 | |
144 $ cat $branchcache | |
145 98d14f698afeaff8cb612dcf215ce95e639effc3 4 | |
146 9d567d0b51f9e2068b054e1948e1a927f99b5874 default | |
147 98d14f698afeaff8cb612dcf215ce95e639effc3 foo | |
148 ed2bbf4e01029020711be82ca905283e883f0e11 bar | |
149 | |
150 Push should update the branch cache: | |
151 | |
152 $ hg init ../target | |
153 | |
154 Pushing just rev 0: | |
155 | |
156 $ hg push -qr 0 ../target | |
5988
ee317dbfb9d0
update the branch cache at the end of addchangegroup
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4410
diff
changeset
|
157 |
12279 | 158 $ cat ../target/$branchcache |
159 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0 | |
160 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default | |
161 | |
162 Pushing everything: | |
163 | |
164 $ hg push -qf ../target | |
165 | |
166 $ cat ../target/$branchcache | |
167 98d14f698afeaff8cb612dcf215ce95e639effc3 4 | |
168 9d567d0b51f9e2068b054e1948e1a927f99b5874 default | |
169 98d14f698afeaff8cb612dcf215ce95e639effc3 foo | |
170 ed2bbf4e01029020711be82ca905283e883f0e11 bar | |
171 | |
172 Update with no arguments: tipmost revision of the current branch: | |
173 | |
174 $ hg up -q -C 0 | |
175 $ hg up -q | |
176 $ hg id | |
177 9d567d0b51f9 | |
178 | |
179 $ hg up -q 1 | |
180 $ hg up -q | |
181 $ hg id | |
182 98d14f698afe (foo) tip | |
183 | |
184 $ hg branch foobar | |
185 marked working directory as branch foobar | |
186 | |
187 $ hg up | |
188 abort: branch foobar not found | |
189 | |
190 Fastforward merge: | |
191 | |
192 $ hg branch ff | |
193 marked working directory as branch ff | |
4231
83153299aab5
avoid a traceback with hg branch newbranch; hg up
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4179
diff
changeset
|
194 |
12279 | 195 $ echo ff > ff |
196 $ hg ci -Am'fast forward' | |
197 adding ff | |
198 | |
199 $ hg up foo | |
200 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
201 | |
202 $ hg merge ff | |
203 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
204 (branch merge, don't forget to commit) | |
4410
bbc97d419b16
Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents:
4232
diff
changeset
|
205 |
12279 | 206 $ hg branch |
207 foo | |
208 $ hg commit -m'Merge ff into foo' | |
209 $ hg parents | |
210 changeset: 6:917eb54e1b4b | |
211 branch: foo | |
212 tag: tip | |
213 parent: 4:98d14f698afe | |
214 parent: 5:6683a60370cb | |
215 user: test | |
216 date: Thu Jan 01 00:00:00 1970 +0000 | |
217 summary: Merge ff into foo | |
218 | |
219 $ hg manifest | |
220 a | |
221 ff | |
222 | |
223 | |
224 Test merging, add 3 default heads and one test head: | |
225 | |
226 $ cd .. | |
227 $ hg init merges | |
228 $ cd merges | |
229 $ echo a > a | |
230 $ hg ci -Ama | |
231 adding a | |
232 | |
233 $ echo b > b | |
234 $ hg ci -Amb | |
235 adding b | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
236 |
12279 | 237 $ hg up 0 |
238 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
239 $ echo c > c | |
240 $ hg ci -Amc | |
241 adding c | |
242 created new head | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
243 |
12279 | 244 $ hg up 0 |
245 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
246 $ echo d > d | |
247 $ hg ci -Amd | |
248 adding d | |
249 created new head | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
250 |
12279 | 251 $ hg up 0 |
252 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
253 $ hg branch test | |
254 marked working directory as branch test | |
255 $ echo e >> e | |
256 $ hg ci -Ame | |
257 adding e | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
258 |
12279 | 259 $ hg log |
260 changeset: 4:3a1e01ed1df4 | |
261 branch: test | |
262 tag: tip | |
263 parent: 0:cb9a9f314b8b | |
264 user: test | |
265 date: Thu Jan 01 00:00:00 1970 +0000 | |
266 summary: e | |
267 | |
268 changeset: 3:980f7dc84c29 | |
269 parent: 0:cb9a9f314b8b | |
270 user: test | |
271 date: Thu Jan 01 00:00:00 1970 +0000 | |
272 summary: d | |
273 | |
274 changeset: 2:d36c0562f908 | |
275 parent: 0:cb9a9f314b8b | |
276 user: test | |
277 date: Thu Jan 01 00:00:00 1970 +0000 | |
278 summary: c | |
279 | |
280 changeset: 1:d2ae7f538514 | |
281 user: test | |
282 date: Thu Jan 01 00:00:00 1970 +0000 | |
283 summary: b | |
284 | |
285 changeset: 0:cb9a9f314b8b | |
286 user: test | |
287 date: Thu Jan 01 00:00:00 1970 +0000 | |
288 summary: a | |
289 | |
290 Implicit merge with test branch as parent: | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
291 |
12279 | 292 $ hg merge |
293 abort: branch 'test' has one head - please merge with an explicit rev | |
294 (run 'hg heads' to see all heads) | |
295 $ hg up -C default | |
296 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
297 | |
298 Implicit merge with default branch as parent: | |
299 | |
300 $ hg merge | |
301 abort: branch 'default' has 3 heads - please merge with an explicit rev | |
302 (run 'hg heads .' to see heads) | |
303 | |
304 3 branch heads, explicit merge required: | |
305 | |
306 $ hg merge 2 | |
307 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
308 (branch merge, don't forget to commit) | |
309 $ hg ci -m merge | |
310 | |
311 2 branch heads, implicit merge works: | |
312 | |
313 $ hg merge | |
314 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
315 (branch merge, don't forget to commit) | |
316 |