Mercurial > hg
comparison tests/test-clone.t @ 11806:fd66a181f575
tests: unify test-clone
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 10 Aug 2010 13:21:28 +0200 |
parents | tests/test-clone@be5e86c80628 |
children | f1c2de22b8a8 |
comparison
equal
deleted
inserted
replaced
11805:8ef250726cf0 | 11806:fd66a181f575 |
---|---|
1 Prepare repo a: | |
2 | |
3 $ mkdir a | |
4 $ cd a | |
5 $ hg init | |
6 $ echo a > a | |
7 $ hg add a | |
8 $ hg commit -m test | |
9 $ echo first line > b | |
10 $ hg add b | |
11 | |
12 Create a non-inlined filelog: | |
13 | |
14 $ python -c 'for x in range(10000): print x' >> data1 | |
15 $ for j in 0 1 2 3 4 5 6 7 8 9; do | |
16 > cat data1 >> b | |
17 > hg commit -m test | |
18 > done | |
19 | |
20 List files in store/data (should show a 'b.d'): | |
21 | |
22 $ for i in .hg/store/data/*; do | |
23 > echo $i | |
24 > done | |
25 .hg/store/data/a.i | |
26 .hg/store/data/b.d | |
27 .hg/store/data/b.i | |
28 | |
29 Default operation: | |
30 | |
31 $ hg clone . ../b | |
32 updating to branch default | |
33 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
34 $ cd ../b | |
35 $ cat a | |
36 a | |
37 $ hg verify | |
38 checking changesets | |
39 checking manifests | |
40 crosschecking files in changesets and manifests | |
41 checking files | |
42 2 files, 11 changesets, 11 total revisions | |
43 | |
44 No update, with debug option: | |
45 | |
46 $ hg --debug clone -U . ../c | |
47 linked 8 files | |
48 $ cd ../c | |
49 $ cat a 2>/dev/null || echo "a not present" | |
50 a not present | |
51 $ hg verify | |
52 checking changesets | |
53 checking manifests | |
54 crosschecking files in changesets and manifests | |
55 checking files | |
56 2 files, 11 changesets, 11 total revisions | |
57 | |
58 Default destination: | |
59 | |
60 $ mkdir ../d | |
61 $ cd ../d | |
62 $ hg clone ../a | |
63 destination directory: a | |
64 updating to branch default | |
65 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
66 $ cd a | |
67 $ hg cat a | |
68 a | |
69 $ cd ../.. | |
70 | |
71 Check that we drop the 'file:' from the path before writing the .hgrc: | |
72 | |
73 $ hg clone file:a e | |
74 updating to branch default | |
75 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
76 $ grep 'file:' e/.hg/hgrc | |
77 | |
78 Check that path aliases are expanded: | |
79 | |
80 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f | |
81 $ hg -R f showconfig paths.default | |
82 .*/a#0 | |
83 | |
84 Use --pull: | |
85 | |
86 $ hg clone --pull a g | |
87 requesting all changes | |
88 adding changesets | |
89 adding manifests | |
90 adding file changes | |
91 added 11 changesets with 11 changes to 2 files | |
92 updating to branch default | |
93 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
94 $ hg -R g verify | |
95 checking changesets | |
96 checking manifests | |
97 crosschecking files in changesets and manifests | |
98 checking files | |
99 2 files, 11 changesets, 11 total revisions | |
100 | |
101 Clone to '.': | |
102 | |
103 $ mkdir h | |
104 $ cd h | |
105 $ hg clone ../a . | |
106 updating to branch default | |
107 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
108 $ cd .. | |
109 | |
110 | |
111 *** Tests for option -u *** | |
112 | |
113 Adding some more history to repo a: | |
114 | |
115 $ cd a | |
116 $ hg tag ref1 | |
117 $ echo the quick brown fox >a | |
118 $ hg ci -m "hacked default" | |
119 $ hg up ref1 | |
120 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
121 $ hg branch stable | |
122 marked working directory as branch stable | |
123 $ echo some text >a | |
124 $ hg ci -m "starting branch stable" | |
125 $ hg tag ref2 | |
126 $ echo some more text >a | |
127 $ hg ci -m "another change for branch stable" | |
128 $ hg up ref2 | |
129 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
130 $ hg parents | |
131 changeset: 13:e8ece76546a6 | |
132 branch: stable | |
133 tag: ref2 | |
134 parent: 10:a7949464abda | |
135 user: test | |
136 date: Thu Jan 01 00:00:00 1970 +0000 | |
137 summary: starting branch stable | |
138 | |
139 | |
140 Repo a has two heads: | |
141 | |
142 $ hg heads | |
143 changeset: 15:0aae7cf88f0d | |
144 branch: stable | |
145 tag: tip | |
146 user: test | |
147 date: Thu Jan 01 00:00:00 1970 +0000 | |
148 summary: another change for branch stable | |
149 | |
150 changeset: 12:f21241060d6a | |
151 user: test | |
152 date: Thu Jan 01 00:00:00 1970 +0000 | |
153 summary: hacked default | |
154 | |
155 | |
156 $ cd .. | |
157 | |
158 | |
159 Testing --noupdate with --updaterev (must abort): | |
160 | |
161 $ hg clone --noupdate --updaterev 1 a ua | |
162 abort: cannot specify both --noupdate and --updaterev | |
163 | |
164 | |
165 Testing clone -u: | |
166 | |
167 $ hg clone -u . a ua | |
168 updating to branch stable | |
169 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
170 | |
171 Repo ua has both heads: | |
172 | |
173 $ hg -R ua heads | |
174 changeset: 15:0aae7cf88f0d | |
175 branch: stable | |
176 tag: tip | |
177 user: test | |
178 date: Thu Jan 01 00:00:00 1970 +0000 | |
179 summary: another change for branch stable | |
180 | |
181 changeset: 12:f21241060d6a | |
182 user: test | |
183 date: Thu Jan 01 00:00:00 1970 +0000 | |
184 summary: hacked default | |
185 | |
186 | |
187 Same revision checked out in repo a and ua: | |
188 | |
189 $ hg -R a parents --template "{node|short}\n" | |
190 e8ece76546a6 | |
191 $ hg -R ua parents --template "{node|short}\n" | |
192 e8ece76546a6 | |
193 | |
194 $ rm -r ua | |
195 | |
196 | |
197 Testing clone --pull -u: | |
198 | |
199 $ hg clone --pull -u . a ua | |
200 requesting all changes | |
201 adding changesets | |
202 adding manifests | |
203 adding file changes | |
204 added 16 changesets with 16 changes to 3 files (+1 heads) | |
205 updating to branch stable | |
206 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
207 | |
208 Repo ua has both heads: | |
209 | |
210 $ hg -R ua heads | |
211 changeset: 15:0aae7cf88f0d | |
212 branch: stable | |
213 tag: tip | |
214 user: test | |
215 date: Thu Jan 01 00:00:00 1970 +0000 | |
216 summary: another change for branch stable | |
217 | |
218 changeset: 12:f21241060d6a | |
219 user: test | |
220 date: Thu Jan 01 00:00:00 1970 +0000 | |
221 summary: hacked default | |
222 | |
223 | |
224 Same revision checked out in repo a and ua: | |
225 | |
226 $ hg -R a parents --template "{node|short}\n" | |
227 e8ece76546a6 | |
228 $ hg -R ua parents --template "{node|short}\n" | |
229 e8ece76546a6 | |
230 | |
231 $ rm -r ua | |
232 | |
233 | |
234 Testing clone -u <branch>: | |
235 | |
236 $ hg clone -u stable a ua | |
237 updating to branch stable | |
238 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
239 | |
240 Repo ua has both heads: | |
241 | |
242 $ hg -R ua heads | |
243 changeset: 15:0aae7cf88f0d | |
244 branch: stable | |
245 tag: tip | |
246 user: test | |
247 date: Thu Jan 01 00:00:00 1970 +0000 | |
248 summary: another change for branch stable | |
249 | |
250 changeset: 12:f21241060d6a | |
251 user: test | |
252 date: Thu Jan 01 00:00:00 1970 +0000 | |
253 summary: hacked default | |
254 | |
255 | |
256 Branch 'stable' is checked out: | |
257 | |
258 $ hg -R ua parents | |
259 changeset: 15:0aae7cf88f0d | |
260 branch: stable | |
261 tag: tip | |
262 user: test | |
263 date: Thu Jan 01 00:00:00 1970 +0000 | |
264 summary: another change for branch stable | |
265 | |
266 | |
267 $ rm -r ua | |
268 | |
269 | |
270 Testing default checkout: | |
271 | |
272 $ hg clone a ua | |
273 updating to branch default | |
274 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
275 | |
276 Repo ua has both heads: | |
277 | |
278 $ hg -R ua heads | |
279 changeset: 15:0aae7cf88f0d | |
280 branch: stable | |
281 tag: tip | |
282 user: test | |
283 date: Thu Jan 01 00:00:00 1970 +0000 | |
284 summary: another change for branch stable | |
285 | |
286 changeset: 12:f21241060d6a | |
287 user: test | |
288 date: Thu Jan 01 00:00:00 1970 +0000 | |
289 summary: hacked default | |
290 | |
291 | |
292 Branch 'default' is checked out: | |
293 | |
294 $ hg -R ua parents | |
295 changeset: 12:f21241060d6a | |
296 user: test | |
297 date: Thu Jan 01 00:00:00 1970 +0000 | |
298 summary: hacked default | |
299 | |
300 | |
301 $ rm -r ua | |
302 | |
303 | |
304 Testing #<branch>: | |
305 | |
306 $ hg clone -u . a#stable ua | |
307 requesting all changes | |
308 adding changesets | |
309 adding manifests | |
310 adding file changes | |
311 added 14 changesets with 14 changes to 3 files | |
312 updating to branch stable | |
313 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
314 | |
315 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): | |
316 | |
317 $ hg -R ua heads | |
318 changeset: 13:0aae7cf88f0d | |
319 branch: stable | |
320 tag: tip | |
321 user: test | |
322 date: Thu Jan 01 00:00:00 1970 +0000 | |
323 summary: another change for branch stable | |
324 | |
325 changeset: 10:a7949464abda | |
326 user: test | |
327 date: Thu Jan 01 00:00:00 1970 +0000 | |
328 summary: test | |
329 | |
330 | |
331 Same revision checked out in repo a and ua: | |
332 | |
333 $ hg -R a parents --template "{node|short}\n" | |
334 e8ece76546a6 | |
335 $ hg -R ua parents --template "{node|short}\n" | |
336 e8ece76546a6 | |
337 | |
338 $ rm -r ua | |
339 | |
340 | |
341 Testing -u -r <branch>: | |
342 | |
343 $ hg clone -u . -r stable a ua | |
344 requesting all changes | |
345 adding changesets | |
346 adding manifests | |
347 adding file changes | |
348 added 14 changesets with 14 changes to 3 files | |
349 updating to branch stable | |
350 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
351 | |
352 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): | |
353 | |
354 $ hg -R ua heads | |
355 changeset: 13:0aae7cf88f0d | |
356 branch: stable | |
357 tag: tip | |
358 user: test | |
359 date: Thu Jan 01 00:00:00 1970 +0000 | |
360 summary: another change for branch stable | |
361 | |
362 changeset: 10:a7949464abda | |
363 user: test | |
364 date: Thu Jan 01 00:00:00 1970 +0000 | |
365 summary: test | |
366 | |
367 | |
368 Same revision checked out in repo a and ua: | |
369 | |
370 $ hg -R a parents --template "{node|short}\n" | |
371 e8ece76546a6 | |
372 $ hg -R ua parents --template "{node|short}\n" | |
373 e8ece76546a6 | |
374 | |
375 $ rm -r ua | |
376 | |
377 | |
378 Testing -r <branch>: | |
379 | |
380 $ hg clone -r stable a ua | |
381 requesting all changes | |
382 adding changesets | |
383 adding manifests | |
384 adding file changes | |
385 added 14 changesets with 14 changes to 3 files | |
386 updating to branch stable | |
387 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
388 | |
389 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6): | |
390 | |
391 $ hg -R ua heads | |
392 changeset: 13:0aae7cf88f0d | |
393 branch: stable | |
394 tag: tip | |
395 user: test | |
396 date: Thu Jan 01 00:00:00 1970 +0000 | |
397 summary: another change for branch stable | |
398 | |
399 changeset: 10:a7949464abda | |
400 user: test | |
401 date: Thu Jan 01 00:00:00 1970 +0000 | |
402 summary: test | |
403 | |
404 | |
405 Branch 'stable' is checked out: | |
406 | |
407 $ hg -R ua parents | |
408 changeset: 13:0aae7cf88f0d | |
409 branch: stable | |
410 tag: tip | |
411 user: test | |
412 date: Thu Jan 01 00:00:00 1970 +0000 | |
413 summary: another change for branch stable | |
414 | |
415 | |
416 $ rm -r ua | |
417 | |
418 | |
419 Testing issue2267: | |
420 | |
421 $ cat <<EOF > simpleclone.py | |
422 > from mercurial import ui, hg | |
423 > myui = ui.ui() | |
424 > repo = hg.repository(myui, 'a') | |
425 > hg.clone(myui, repo, dest="ua") | |
426 > EOF | |
427 | |
428 $ python simpleclone.py | |
429 updating to branch default | |
430 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
431 | |
432 $ rm -r ua | |
433 |