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