author | Markus F.X.J. Oberhumer <markus@oberhumer.com> |
Wed, 23 Mar 2011 02:33:24 +0100 | |
changeset 13732 | afe9269dccec |
parent 13550 | 1792b8a9422b |
child 14162 | 301725c3df9a |
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 |
|
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 |
13446
1e497df514e2
rollback: clarifies the message about the reverted state (issue2628)
Gilles Moris <gilles.moris@free.fr>
parents:
13272
diff
changeset
|
108 |
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
|
109 |
working directory now based on revisions 4 and 3 |
12279 | 110 |
|
111 |
$ cp $branchcache .hg/bc-invalid |
|
112 |
||
113 |
$ hg log -r foo |
|
114 |
changeset: 4:98d14f698afe |
|
115 |
branch: foo |
|
116 |
tag: tip |
|
117 |
parent: 1:0079f24813e2 |
|
118 |
user: test |
|
119 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
120 |
summary: modify a branch |
|
121 |
||
122 |
$ cp .hg/bc-invalid $branchcache |
|
4175
fc12ac3755d5
Test update to branch tip
Brendan Cully <brendan@kublai.com>
parents:
4169
diff
changeset
|
123 |
|
12279 | 124 |
$ hg --debug log -r foo |
125 |
invalidating branch cache (tip differs) |
|
126 |
changeset: 4:98d14f698afeaff8cb612dcf215ce95e639effc3 |
|
127 |
branch: foo |
|
128 |
tag: tip |
|
129 |
parent: 1:0079f24813e2b73a891577c243684c5066347bc8 |
|
130 |
parent: -1:0000000000000000000000000000000000000000 |
|
131 |
manifest: 4:d01b250baaa05909152f7ae07d7a649deea0df9a |
|
132 |
user: test |
|
133 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
134 |
files: a |
|
135 |
extra: branch=foo |
|
136 |
description: |
|
137 |
modify a branch |
|
138 |
||
139 |
||
140 |
$ rm $branchcache |
|
141 |
$ echo corrupted > $branchcache |
|
142 |
||
143 |
$ hg log -qr foo |
|
144 |
4:98d14f698afe |
|
145 |
||
146 |
$ cat $branchcache |
|
147 |
98d14f698afeaff8cb612dcf215ce95e639effc3 4 |
|
148 |
9d567d0b51f9e2068b054e1948e1a927f99b5874 default |
|
149 |
98d14f698afeaff8cb612dcf215ce95e639effc3 foo |
|
150 |
ed2bbf4e01029020711be82ca905283e883f0e11 bar |
|
151 |
||
152 |
Push should update the branch cache: |
|
153 |
||
154 |
$ hg init ../target |
|
155 |
||
156 |
Pushing just rev 0: |
|
157 |
||
158 |
$ 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
|
159 |
|
12279 | 160 |
$ cat ../target/$branchcache |
161 |
db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 0 |
|
162 |
db01e8ea3388fd3c7c94e1436ea2bd6a53d581c5 default |
|
163 |
||
164 |
Pushing everything: |
|
165 |
||
166 |
$ hg push -qf ../target |
|
167 |
||
168 |
$ cat ../target/$branchcache |
|
169 |
98d14f698afeaff8cb612dcf215ce95e639effc3 4 |
|
170 |
9d567d0b51f9e2068b054e1948e1a927f99b5874 default |
|
171 |
98d14f698afeaff8cb612dcf215ce95e639effc3 foo |
|
172 |
ed2bbf4e01029020711be82ca905283e883f0e11 bar |
|
173 |
||
174 |
Update with no arguments: tipmost revision of the current branch: |
|
175 |
||
176 |
$ hg up -q -C 0 |
|
177 |
$ hg up -q |
|
178 |
$ hg id |
|
179 |
9d567d0b51f9 |
|
180 |
||
181 |
$ hg up -q 1 |
|
182 |
$ hg up -q |
|
183 |
$ hg id |
|
184 |
98d14f698afe (foo) tip |
|
185 |
||
186 |
$ hg branch foobar |
|
187 |
marked working directory as branch foobar |
|
188 |
||
189 |
$ hg up |
|
190 |
abort: branch foobar not found |
|
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
191 |
[255] |
12279 | 192 |
|
193 |
Fastforward merge: |
|
194 |
||
195 |
$ hg branch ff |
|
196 |
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
|
197 |
|
12279 | 198 |
$ echo ff > ff |
199 |
$ hg ci -Am'fast forward' |
|
200 |
adding ff |
|
201 |
||
202 |
$ hg up foo |
|
203 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
204 |
||
205 |
$ hg merge ff |
|
206 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
207 |
(branch merge, don't forget to commit) |
|
4410
bbc97d419b16
Add fast-forward branch merging
Brendan Cully <brendan@kublai.com>
parents:
4232
diff
changeset
|
208 |
|
12279 | 209 |
$ hg branch |
210 |
foo |
|
211 |
$ hg commit -m'Merge ff into foo' |
|
212 |
$ hg parents |
|
13550
1792b8a9422b
merge: back out single-parent fast-forward merge
Matt Mackall <mpm@selenic.com>
parents:
13455
diff
changeset
|
213 |
changeset: 6:917eb54e1b4b |
12279 | 214 |
branch: foo |
215 |
tag: tip |
|
13550
1792b8a9422b
merge: back out single-parent fast-forward merge
Matt Mackall <mpm@selenic.com>
parents:
13455
diff
changeset
|
216 |
parent: 4:98d14f698afe |
1792b8a9422b
merge: back out single-parent fast-forward merge
Matt Mackall <mpm@selenic.com>
parents:
13455
diff
changeset
|
217 |
parent: 5:6683a60370cb |
12279 | 218 |
user: test |
219 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
220 |
summary: Merge ff into foo |
|
221 |
||
222 |
$ hg manifest |
|
223 |
a |
|
224 |
ff |
|
225 |
||
226 |
||
227 |
Test merging, add 3 default heads and one test head: |
|
228 |
||
229 |
$ cd .. |
|
230 |
$ hg init merges |
|
231 |
$ cd merges |
|
232 |
$ echo a > a |
|
233 |
$ hg ci -Ama |
|
234 |
adding a |
|
235 |
||
236 |
$ echo b > b |
|
237 |
$ hg ci -Amb |
|
238 |
adding b |
|
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
239 |
|
12279 | 240 |
$ hg up 0 |
241 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
242 |
$ echo c > c |
|
243 |
$ hg ci -Amc |
|
244 |
adding c |
|
245 |
created new head |
|
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 d > d |
|
250 |
$ hg ci -Amd |
|
251 |
adding d |
|
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 |
$ hg branch test |
|
257 |
marked working directory as branch test |
|
258 |
$ echo e >> e |
|
259 |
$ hg ci -Ame |
|
260 |
adding e |
|
6723
1fe6f365df2e
merge: only in-branch merges can be implicit
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
6160
diff
changeset
|
261 |
|
12279 | 262 |
$ hg log |
263 |
changeset: 4:3a1e01ed1df4 |
|
264 |
branch: test |
|
265 |
tag: tip |
|
266 |
parent: 0:cb9a9f314b8b |
|
267 |
user: test |
|
268 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
269 |
summary: e |
|
270 |
||
271 |
changeset: 3:980f7dc84c29 |
|
272 |
parent: 0:cb9a9f314b8b |
|
273 |
user: test |
|
274 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
275 |
summary: d |
|
276 |
||
277 |
changeset: 2:d36c0562f908 |
|
278 |
parent: 0:cb9a9f314b8b |
|
279 |
user: test |
|
280 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
281 |
summary: c |
|
282 |
||
283 |
changeset: 1:d2ae7f538514 |
|
284 |
user: test |
|
285 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
286 |
summary: b |
|
287 |
||
288 |
changeset: 0:cb9a9f314b8b |
|
289 |
user: test |
|
290 |
date: Thu Jan 01 00:00:00 1970 +0000 |
|
291 |
summary: a |
|
292 |
||
293 |
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
|
294 |
|
12279 | 295 |
$ hg merge |
296 |
abort: branch 'test' has one head - please merge with an explicit rev |
|
297 |
(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
|
298 |
[255] |
12279 | 299 |
$ hg up -C default |
300 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
301 |
||
302 |
Implicit merge with default branch as parent: |
|
303 |
||
304 |
$ hg merge |
|
305 |
abort: branch 'default' has 3 heads - please merge with an explicit rev |
|
306 |
(run 'hg heads .' to see heads) |
|
12316
4134686b83e1
tests: add exit codes to unified tests
Matt Mackall <mpm@selenic.com>
parents:
12279
diff
changeset
|
307 |
[255] |
12279 | 308 |
|
309 |
3 branch heads, explicit merge required: |
|
310 |
||
311 |
$ hg merge 2 |
|
312 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
313 |
(branch merge, don't forget to commit) |
|
314 |
$ hg ci -m merge |
|
315 |
||
316 |
2 branch heads, implicit merge works: |
|
317 |
||
318 |
$ hg merge |
|
319 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
320 |
(branch merge, don't forget to commit) |
|
321 |