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