author | Mads Kiilerich <madski@unity3d.com> |
Fri, 28 Dec 2012 11:55:57 +0100 | |
changeset 18149 | 2dcc3653b361 |
parent 16913 | f2719b387380 |
child 18166 | 3a2e810dd3d8 |
permissions | -rw-r--r-- |
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 |
|
15907
51fc43253a52
changeset_printer: display changeset phase on debug level
Pierre-Yves David <pierre-yves.david@ens-lyon.org>
parents:
15615
diff
changeset
|
133 |
phase: draft |
14162
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
134 |
parent: 1:6c0e42da283a56b5edc5b4fadb491365ec7f5fa8 |
12279 | 135 |
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
|
136 |
manifest: 1:8c342a37dfba0b3d3ce073562a00d8a813c54ffe |
12279 | 137 |
user: test |
138 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
139 |
files: a |
|
140 |
extra: branch=foo |
|
141 |
description: |
|
142 |
modify a branch |
|
143 |
||
144 |
||
145 |
$ rm $branchcache |
|
146 |
$ echo corrupted > $branchcache |
|
147 |
||
148 |
$ 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
|
149 |
4:adf1a74a7f7b |
12279 | 150 |
|
151 |
$ 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
|
152 |
adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
153 |
1c28f494dae69a2f8fc815059d257eccf3fcfe75 default |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
154 |
adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
155 |
c21617b13b220988e7a2e26290fbe4325ffa7139 bar |
12279 | 156 |
|
157 |
Push should update the branch cache: |
|
158 |
||
159 |
$ hg init ../target |
|
160 |
||
161 |
Pushing just rev 0: |
|
162 |
||
163 |
$ 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
|
164 |
|
12279 | 165 |
$ cat ../target/$branchcache |
166 |
db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0 |
|
167 |
db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default |
|
168 |
||
169 |
Pushing everything: |
|
170 |
||
171 |
$ hg push -qf ../target |
|
172 |
||
173 |
$ 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
|
174 |
adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 4 |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
175 |
1c28f494dae69a2f8fc815059d257eccf3fcfe75 default |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
176 |
adf1a74a7f7b4cd193d12992f5d0d6a004ed21d6 foo |
301725c3df9a
localrepo: reuse parent manifest in commitctx if no files have changed
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents:
13550
diff
changeset
|
177 |
c21617b13b220988e7a2e26290fbe4325ffa7139 bar |
12279 | 178 |
|
179 |
Update with no arguments: tipmost revision of the current branch: |
|
180 |
||
181 |
$ hg up -q -C 0 |
|
182 |
$ hg up -q |
|
183 |
$ 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
|
184 |
1c28f494dae6 |
12279 | 185 |
|
186 |
$ hg up -q 1 |
|
187 |
$ hg up -q |
|
188 |
$ 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
|
189 |
adf1a74a7f7b (foo) tip |
12279 | 190 |
|
191 |
$ hg branch foobar |
|
192 |
marked working directory as branch foobar |
|
15615 | 193 |
(branches are permanent and global, did you want a bookmark?) |
12279 | 194 |
|
195 |
$ hg up |
|
196 |
abort: branch foobar not found |
|
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
197 |
[255] |
12279 | 198 |
|
199 |
Fastforward merge: |
|
200 |
||
201 |
$ hg branch ff |
|
202 |
marked working directory as branch ff |
|
15615 | 203 |
(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
|
204 |
|
12279 | 205 |
$ echo ff > ff |
206 |
$ hg ci -Am'fast forward' |
|
207 |
adding ff |
|
208 |
||
209 |
$ hg up foo |
|
210 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
211 |
||
212 |
$ hg merge ff |
|
213 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
214 |
(branch merge, don't forget to commit) |
|
4410
bbc97d419b16
Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents:
4232
diff
changeset
|
215 |
|
12279 | 216 |
$ hg branch |
217 |
foo |
|
218 |
$ hg commit -m'Merge ff into foo' |
|
219 |
$ 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
|
220 |
changeset: 6:185ffbfefa30 |
12279 | 221 |
branch: foo |
222 |
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
|
223 |
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
|
224 |
parent: 5:1a3c27dc5e11 |
12279 | 225 |
user: test |
226 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
227 |
summary: Merge ff into foo |
|
228 |
||
229 |
$ hg manifest |
|
230 |
a |
|
231 |
ff |
|
232 |
||
233 |
||
234 |
Test merging, add 3 default heads and one test head: |
|
235 |
||
236 |
$ cd .. |
|
237 |
$ hg init merges |
|
238 |
$ cd merges |
|
239 |
$ echo a > a |
|
240 |
$ hg ci -Ama |
|
241 |
adding a |
|
242 |
||
243 |
$ echo b > b |
|
244 |
$ hg ci -Amb |
|
245 |
adding b |
|
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
246 |
|
12279 | 247 |
$ hg up 0 |
248 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
249 |
$ echo c > c |
|
250 |
$ hg ci -Amc |
|
251 |
adding c |
|
252 |
created new head |
|
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
253 |
|
12279 | 254 |
$ hg up 0 |
255 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
256 |
$ echo d > d |
|
257 |
$ hg ci -Amd |
|
258 |
adding d |
|
259 |
created new head |
|
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
260 |
|
12279 | 261 |
$ hg up 0 |
262 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
263 |
$ hg branch test |
|
264 |
marked working directory as branch test |
|
15615 | 265 |
(branches are permanent and global, did you want a bookmark?) |
12279 | 266 |
$ echo e >> e |
267 |
$ hg ci -Ame |
|
268 |
adding e |
|
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
269 |
|
12279 | 270 |
$ hg log |
271 |
changeset: 4:3a1e01ed1df4 |
|
272 |
branch: test |
|
273 |
tag: tip |
|
274 |
parent: 0:cb9a9f314b8b |
|
275 |
user: test |
|
276 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
277 |
summary: e |
|
278 |
||
279 |
changeset: 3:980f7dc84c29 |
|
280 |
parent: 0:cb9a9f314b8b |
|
281 |
user: test |
|
282 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
283 |
summary: d |
|
284 |
||
285 |
changeset: 2:d36c0562f908 |
|
286 |
parent: 0:cb9a9f314b8b |
|
287 |
user: test |
|
288 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
289 |
summary: c |
|
290 |
||
291 |
changeset: 1:d2ae7f538514 |
|
292 |
user: test |
|
293 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
294 |
summary: b |
|
295 |
||
296 |
changeset: 0:cb9a9f314b8b |
|
297 |
user: test |
|
298 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
299 |
summary: a |
|
300 |
||
301 |
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
|
302 |
|
12279 | 303 |
$ hg merge |
304 |
abort: branch 'test' has one head - please merge with an explicit rev |
|
305 |
(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
|
306 |
[255] |
12279 | 307 |
$ hg up -C default |
308 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
309 |
||
310 |
Implicit merge with default branch as parent: |
|
311 |
||
312 |
$ hg merge |
|
313 |
abort: branch 'default' has 3 heads - please merge with an explicit rev |
|
314 |
(run 'hg heads .' to see heads) |
|
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
315 |
[255] |
12279 | 316 |
|
317 |
3 branch heads, explicit merge required: |
|
318 |
||
319 |
$ hg merge 2 |
|
320 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
321 |
(branch merge, don't forget to commit) |
|
322 |
$ hg ci -m merge |
|
323 |
||
324 |
2 branch heads, implicit merge works: |
|
325 |
||
326 |
$ hg merge |
|
327 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
328 |
(branch merge, don't forget to commit) |
|
329 |
||
16913
f2719b387380
tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents:
15907
diff
changeset
|
330 |
$ cd .. |