Mercurial > hg
annotate tests/test-newbranch.t @ 15885:222fb8a512eb
tests: make qnew in test-mq-caches.t stable
The unstable hashes did for other reasons not show up in the test output.
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 13 Jan 2012 01:19:08 +0100 |
parents | 41885892796e |
children | 51fc43253a52 |
rev | line source |
---|---|
13272
5ccdca7df211
move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
jfh <jason@jasonfharris.com>
parents:
13158
diff
changeset
|
1 $ branchcache=.hg/cache/branchheads |
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 | |
15615 | 12 (branches are permanent and global, did you want a bookmark?) |
12279 | 13 $ hg branch |
14 foo | |
15 $ hg ci -m "add branch name" | |
16 $ hg branch bar | |
17 marked working directory as branch bar | |
15615 | 18 (branches are permanent and global, did you want a bookmark?) |
12279 | 19 $ hg ci -m "change branch name" |
20 | |
21 Branch shadowing: | |
22 | |
23 $ hg branch default | |
14198
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14162
diff
changeset
|
24 abort: a branch of the same name already exists |
8f11fd321014
commands: use util.Abort's hint some more
Martin Geisler <mg@aragost.com>
parents:
14162
diff
changeset
|
25 (use 'hg update' to switch to it) |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
26 [255] |
12279 | 27 |
28 $ hg branch -f default | |
29 marked working directory as branch default | |
15615 | 30 (branches are permanent and global, did you want a bookmark?) |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
31 |
12279 | 32 $ hg ci -m "clear branch name" |
33 created new head | |
34 | |
35 There should be only one default branch head | |
36 | |
37 $ hg heads . | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
38 changeset: 3:1c28f494dae6 |
12279 | 39 tag: tip |
40 user: test | |
41 date: Thu Jan 01 00:00:00 1970 +0000 | |
42 summary: clear branch name | |
43 | |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
44 |
12279 | 45 $ hg co foo |
46 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
47 $ hg branch | |
48 foo | |
49 $ echo bleah > a | |
50 $ hg ci -m "modify a branch" | |
51 | |
52 $ hg merge default | |
53 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
54 (branch merge, don't forget to commit) | |
55 | |
56 $ hg branch | |
57 foo | |
58 $ 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
|
59 |
12279 | 60 $ hg log |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
61 changeset: 5:530046499edf |
12279 | 62 branch: foo |
63 tag: tip | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
64 parent: 4:adf1a74a7f7b |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
65 parent: 3:1c28f494dae6 |
12279 | 66 user: test |
67 date: Thu Jan 01 00:00:00 1970 +0000 | |
68 summary: merge | |
69 | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
70 changeset: 4:adf1a74a7f7b |
12279 | 71 branch: foo |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
72 parent: 1:6c0e42da283a |
12279 | 73 user: test |
74 date: Thu Jan 01 00:00:00 1970 +0000 | |
75 summary: modify a branch | |
76 | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
77 changeset: 3:1c28f494dae6 |
12279 | 78 user: test |
79 date: Thu Jan 01 00:00:00 1970 +0000 | |
80 summary: clear branch name | |
81 | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
82 changeset: 2:c21617b13b22 |
12279 | 83 branch: bar |
84 user: test | |
85 date: Thu Jan 01 00:00:00 1970 +0000 | |
86 summary: change branch name | |
87 | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
88 changeset: 1:6c0e42da283a |
12279 | 89 branch: foo |
90 user: test | |
91 date: Thu Jan 01 00:00:00 1970 +0000 | |
92 summary: add branch name | |
93 | |
94 changeset: 0:db01e8ea3388 | |
95 user: test | |
96 date: Thu Jan 01 00:00:00 1970 +0000 | |
97 summary: initial | |
98 | |
99 $ hg branches | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
100 foo 5:530046499edf |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
101 default 3:1c28f494dae6 (inactive) |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
102 bar 2:c21617b13b22 (inactive) |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
103 |
12279 | 104 $ hg branches -q |
105 foo | |
106 default | |
107 bar | |
3420
2576b6731524
Add some basic branch name tests
Matt Mackall <mpm@selenic.com>
parents:
diff
changeset
|
108 |
12279 | 109 Test for invalid branch cache: |
3502
8dc14d630b29
add branch and branches commands
Matt Mackall <mpm@selenic.com>
parents:
3451
diff
changeset
|
110 |
12279 | 111 $ hg rollback |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13272
diff
changeset
|
112 repository tip rolled back to revision 4 (undo commit) |
13455
053c042118bc
rollback, i18n: avoid parameterized message
Wagner Bruna <wbruna@softwareexpress.com.br>
parents:
13446
diff
changeset
|
113 working directory now based on revisions 4 and 3 |
12279 | 114 |
115 $ cp $branchcache .hg/bc-invalid | |
116 | |
117 $ hg log -r foo | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
118 changeset: 4:adf1a74a7f7b |
12279 | 119 branch: foo |
120 tag: tip | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
121 parent: 1:6c0e42da283a |
12279 | 122 user: test |
123 date: Thu Jan 01 00:00:00 1970 +0000 | |
124 summary: modify a branch | |
125 | |
126 $ cp .hg/bc-invalid $branchcache | |
4175
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
127 |
12279 | 128 $ hg --debug log -r foo |
129 invalidating branch cache (tip differs) | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
130 changeset: 4:adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 |
12279 | 131 branch: foo |
132 tag: tip | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
133 parent: 1:6c0e42da283a56b5edc5b4fadb491365ec7f5fa8 |
12279 | 134 parent: -1:0000000000000000000000000000000000000000 |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
135 manifest: 1:8c342a37dfba0b3d3ce073562a00d8a813c54ffe |
12279 | 136 user: test |
137 date: Thu Jan 01 00:00:00 1970 +0000 | |
138 files: a | |
139 extra: branch=foo | |
140 description: | |
141 modify a branch | |
142 | |
143 | |
144 $ rm $branchcache | |
145 $ echo corrupted > $branchcache | |
146 | |
147 $ hg log -qr foo | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
148 4:adf1a74a7f7b |
12279 | 149 |
150 $ cat $branchcache | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
151 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
152 1c28f494dae69a2f8fc815059d257eccf3fcfe75 default |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
153 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
154 c21617b13b220988e7a2e26290fbe4325ffa7139 bar |
12279 | 155 |
156 Push should update the branch cache: | |
157 | |
158 $ hg init ../target | |
159 | |
160 Pushing just rev 0: | |
161 | |
162 $ 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
|
163 |
12279 | 164 $ cat ../target/$branchcache |
165 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0 | |
166 db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default | |
167 | |
168 Pushing everything: | |
169 | |
170 $ hg push -qf ../target | |
171 | |
172 $ cat ../target/$branchcache | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
173 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
174 1c28f494dae69a2f8fc815059d257eccf3fcfe75 default |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
175 adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
176 c21617b13b220988e7a2e26290fbe4325ffa7139 bar |
12279 | 177 |
178 Update with no arguments: tipmost revision of the current branch: | |
179 | |
180 $ hg up -q -C 0 | |
181 $ hg up -q | |
182 $ hg id | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
183 1c28f494dae6 |
12279 | 184 |
185 $ hg up -q 1 | |
186 $ hg up -q | |
187 $ hg id | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
188 adf1a74a7f7b (foo) tip |
12279 | 189 |
190 $ hg branch foobar | |
191 marked working directory as branch foobar | |
15615 | 192 (branches are permanent and global, did you want a bookmark?) |
12279 | 193 |
194 $ hg up | |
195 abort: branch foobar not found | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
196 [255] |
12279 | 197 |
198 Fastforward merge: | |
199 | |
200 $ hg branch ff | |
201 marked working directory as branch ff | |
15615 | 202 (branches are permanent and global, did you want a bookmark?) |
4231
83153299aab5
avoid a traceback with hg branch newbranch; hg up
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
4179
diff
changeset
|
203 |
12279 | 204 $ echo ff > ff |
205 $ hg ci -Am'fast forward' | |
206 adding ff | |
207 | |
208 $ hg up foo | |
209 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
210 | |
211 $ hg merge ff | |
212 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
213 (branch merge, don't forget to commit) | |
4410
bbc97d419b16
Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents:
4232
diff
changeset
|
214 |
12279 | 215 $ hg branch |
216 foo | |
217 $ hg commit -m'Merge ff into foo' | |
218 $ hg parents | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
219 changeset: 6:185ffbfefa30 |
12279 | 220 branch: foo |
221 tag: tip | |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
222 parent: 4:adf1a74a7f7b |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
223 parent: 5:1a3c27dc5e11 |
12279 | 224 user: test |
225 date: Thu Jan 01 00:00:00 1970 +0000 | |
226 summary: Merge ff into foo | |
227 | |
228 $ hg manifest | |
229 a | |
230 ff | |
231 | |
232 | |
233 Test merging, add 3 default heads and one test head: | |
234 | |
235 $ cd .. | |
236 $ hg init merges | |
237 $ cd merges | |
238 $ echo a > a | |
239 $ hg ci -Ama | |
240 adding a | |
241 | |
242 $ echo b > b | |
243 $ hg ci -Amb | |
244 adding b | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
245 |
12279 | 246 $ hg up 0 |
247 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
248 $ echo c > c | |
249 $ hg ci -Amc | |
250 adding c | |
251 created new head | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
252 |
12279 | 253 $ hg up 0 |
254 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
255 $ echo d > d | |
256 $ hg ci -Amd | |
257 adding d | |
258 created new head | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
259 |
12279 | 260 $ hg up 0 |
261 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
262 $ hg branch test | |
263 marked working directory as branch test | |
15615 | 264 (branches are permanent and global, did you want a bookmark?) |
12279 | 265 $ echo e >> e |
266 $ hg ci -Ame | |
267 adding e | |
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
268 |
12279 | 269 $ hg log |
270 changeset: 4:3a1e01ed1df4 | |
271 branch: test | |
272 tag: tip | |
273 parent: 0:cb9a9f314b8b | |
274 user: test | |
275 date: Thu Jan 01 00:00:00 1970 +0000 | |
276 summary: e | |
277 | |
278 changeset: 3:980f7dc84c29 | |
279 parent: 0:cb9a9f314b8b | |
280 user: test | |
281 date: Thu Jan 01 00:00:00 1970 +0000 | |
282 summary: d | |
283 | |
284 changeset: 2:d36c0562f908 | |
285 parent: 0:cb9a9f314b8b | |
286 user: test | |
287 date: Thu Jan 01 00:00:00 1970 +0000 | |
288 summary: c | |
289 | |
290 changeset: 1:d2ae7f538514 | |
291 user: test | |
292 date: Thu Jan 01 00:00:00 1970 +0000 | |
293 summary: b | |
294 | |
295 changeset: 0:cb9a9f314b8b | |
296 user: test | |
297 date: Thu Jan 01 00:00:00 1970 +0000 | |
298 summary: a | |
299 | |
300 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
|
301 |
12279 | 302 $ hg merge |
303 abort: branch 'test' has one head - please merge with an explicit rev | |
304 (run 'hg heads' to see all heads) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
305 [255] |
12279 | 306 $ hg up -C default |
307 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
308 | |
309 Implicit merge with default branch as parent: | |
310 | |
311 $ hg merge | |
312 abort: branch 'default' has 3 heads - please merge with an explicit rev | |
313 (run 'hg heads .' to see heads) | |
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
314 [255] |
12279 | 315 |
316 3 branch heads, explicit merge required: | |
317 | |
318 $ hg merge 2 | |
319 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
320 (branch merge, don't forget to commit) | |
321 $ hg ci -m merge | |
322 | |
323 2 branch heads, implicit merge works: | |
324 | |
325 $ hg merge | |
326 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
327 (branch merge, don't forget to commit) | |
328 |