##// END OF EJS Templates
test-clone: fix directory level...
Adrian Buehlmann -
r17881:603d4fba stable
parent child Browse files
Show More
@@ -1,612 +1,613 b''
1 1 Prepare repo a:
2 2
3 3 $ hg init a
4 4 $ cd a
5 5 $ echo a > a
6 6 $ hg add a
7 7 $ hg commit -m test
8 8 $ echo first line > b
9 9 $ hg add b
10 10
11 11 Create a non-inlined filelog:
12 12
13 13 $ python -c 'file("data1", "wb").write("".join("%s\n" % x for x in range(10000)))'
14 14 $ for j in 0 1 2 3 4 5 6 7 8 9; do
15 15 > cat data1 >> b
16 16 > hg commit -m test
17 17 > done
18 18
19 19 List files in store/data (should show a 'b.d'):
20 20
21 21 $ for i in .hg/store/data/*; do
22 22 > echo $i
23 23 > done
24 24 .hg/store/data/a.i
25 25 .hg/store/data/b.d
26 26 .hg/store/data/b.i
27 27
28 28 Default operation:
29 29
30 30 $ hg clone . ../b
31 31 updating to branch default
32 32 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
33 33 $ cd ../b
34 34 $ cat a
35 35 a
36 36 $ hg verify
37 37 checking changesets
38 38 checking manifests
39 39 crosschecking files in changesets and manifests
40 40 checking files
41 41 2 files, 11 changesets, 11 total revisions
42 42
43 43 Invalid dest '' must abort:
44 44
45 45 $ hg clone . ''
46 46 abort: empty destination path is not valid
47 47 [255]
48 48
49 49 No update, with debug option:
50 50
51 51 #if hardlink
52 52 $ hg --debug clone -U . ../c
53 53 linked 8 files
54 54 listing keys for "bookmarks"
55 55 #else
56 56 $ hg --debug clone -U . ../c
57 57 copied 8 files
58 58 listing keys for "bookmarks"
59 59 #endif
60 60 $ cd ../c
61 61 $ cat a 2>/dev/null || echo "a not present"
62 62 a not present
63 63 $ hg verify
64 64 checking changesets
65 65 checking manifests
66 66 crosschecking files in changesets and manifests
67 67 checking files
68 68 2 files, 11 changesets, 11 total revisions
69 69
70 70 Default destination:
71 71
72 72 $ mkdir ../d
73 73 $ cd ../d
74 74 $ hg clone ../a
75 75 destination directory: a
76 76 updating to branch default
77 77 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
78 78 $ cd a
79 79 $ hg cat a
80 80 a
81 81 $ cd ../..
82 82
83 83 Check that we drop the 'file:' from the path before writing the .hgrc:
84 84
85 85 $ hg clone file:a e
86 86 updating to branch default
87 87 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
88 88 $ grep 'file:' e/.hg/hgrc
89 89 [1]
90 90
91 91 Check that path aliases are expanded:
92 92
93 93 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
94 94 $ hg -R f showconfig paths.default
95 95 $TESTTMP/a#0 (glob)
96 96
97 97 Use --pull:
98 98
99 99 $ hg clone --pull a g
100 100 requesting all changes
101 101 adding changesets
102 102 adding manifests
103 103 adding file changes
104 104 added 11 changesets with 11 changes to 2 files
105 105 updating to branch default
106 106 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
107 107 $ hg -R g verify
108 108 checking changesets
109 109 checking manifests
110 110 crosschecking files in changesets and manifests
111 111 checking files
112 112 2 files, 11 changesets, 11 total revisions
113 113
114 114 Invalid dest '' with --pull must abort (issue2528):
115 115
116 116 $ hg clone --pull a ''
117 117 abort: empty destination path is not valid
118 118 [255]
119 119
120 120 Clone to '.':
121 121
122 122 $ mkdir h
123 123 $ cd h
124 124 $ hg clone ../a .
125 125 updating to branch default
126 126 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
127 127 $ cd ..
128 128
129 129
130 130 *** Tests for option -u ***
131 131
132 132 Adding some more history to repo a:
133 133
134 134 $ cd a
135 135 $ hg tag ref1
136 136 $ echo the quick brown fox >a
137 137 $ hg ci -m "hacked default"
138 138 $ hg up ref1
139 139 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
140 140 $ hg branch stable
141 141 marked working directory as branch stable
142 142 (branches are permanent and global, did you want a bookmark?)
143 143 $ echo some text >a
144 144 $ hg ci -m "starting branch stable"
145 145 $ hg tag ref2
146 146 $ echo some more text >a
147 147 $ hg ci -m "another change for branch stable"
148 148 $ hg up ref2
149 149 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
150 150 $ hg parents
151 151 changeset: 13:e8ece76546a6
152 152 branch: stable
153 153 tag: ref2
154 154 parent: 10:a7949464abda
155 155 user: test
156 156 date: Thu Jan 01 00:00:00 1970 +0000
157 157 summary: starting branch stable
158 158
159 159
160 160 Repo a has two heads:
161 161
162 162 $ hg heads
163 163 changeset: 15:0aae7cf88f0d
164 164 branch: stable
165 165 tag: tip
166 166 user: test
167 167 date: Thu Jan 01 00:00:00 1970 +0000
168 168 summary: another change for branch stable
169 169
170 170 changeset: 12:f21241060d6a
171 171 user: test
172 172 date: Thu Jan 01 00:00:00 1970 +0000
173 173 summary: hacked default
174 174
175 175
176 176 $ cd ..
177 177
178 178
179 179 Testing --noupdate with --updaterev (must abort):
180 180
181 181 $ hg clone --noupdate --updaterev 1 a ua
182 182 abort: cannot specify both --noupdate and --updaterev
183 183 [255]
184 184
185 185
186 186 Testing clone -u:
187 187
188 188 $ hg clone -u . a ua
189 189 updating to branch stable
190 190 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 191
192 192 Repo ua has both heads:
193 193
194 194 $ hg -R ua heads
195 195 changeset: 15:0aae7cf88f0d
196 196 branch: stable
197 197 tag: tip
198 198 user: test
199 199 date: Thu Jan 01 00:00:00 1970 +0000
200 200 summary: another change for branch stable
201 201
202 202 changeset: 12:f21241060d6a
203 203 user: test
204 204 date: Thu Jan 01 00:00:00 1970 +0000
205 205 summary: hacked default
206 206
207 207
208 208 Same revision checked out in repo a and ua:
209 209
210 210 $ hg -R a parents --template "{node|short}\n"
211 211 e8ece76546a6
212 212 $ hg -R ua parents --template "{node|short}\n"
213 213 e8ece76546a6
214 214
215 215 $ rm -r ua
216 216
217 217
218 218 Testing clone --pull -u:
219 219
220 220 $ hg clone --pull -u . a ua
221 221 requesting all changes
222 222 adding changesets
223 223 adding manifests
224 224 adding file changes
225 225 added 16 changesets with 16 changes to 3 files (+1 heads)
226 226 updating to branch stable
227 227 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
228 228
229 229 Repo ua has both heads:
230 230
231 231 $ hg -R ua heads
232 232 changeset: 15:0aae7cf88f0d
233 233 branch: stable
234 234 tag: tip
235 235 user: test
236 236 date: Thu Jan 01 00:00:00 1970 +0000
237 237 summary: another change for branch stable
238 238
239 239 changeset: 12:f21241060d6a
240 240 user: test
241 241 date: Thu Jan 01 00:00:00 1970 +0000
242 242 summary: hacked default
243 243
244 244
245 245 Same revision checked out in repo a and ua:
246 246
247 247 $ hg -R a parents --template "{node|short}\n"
248 248 e8ece76546a6
249 249 $ hg -R ua parents --template "{node|short}\n"
250 250 e8ece76546a6
251 251
252 252 $ rm -r ua
253 253
254 254
255 255 Testing clone -u <branch>:
256 256
257 257 $ hg clone -u stable a ua
258 258 updating to branch stable
259 259 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
260 260
261 261 Repo ua has both heads:
262 262
263 263 $ hg -R ua heads
264 264 changeset: 15:0aae7cf88f0d
265 265 branch: stable
266 266 tag: tip
267 267 user: test
268 268 date: Thu Jan 01 00:00:00 1970 +0000
269 269 summary: another change for branch stable
270 270
271 271 changeset: 12:f21241060d6a
272 272 user: test
273 273 date: Thu Jan 01 00:00:00 1970 +0000
274 274 summary: hacked default
275 275
276 276
277 277 Branch 'stable' is checked out:
278 278
279 279 $ hg -R ua parents
280 280 changeset: 15:0aae7cf88f0d
281 281 branch: stable
282 282 tag: tip
283 283 user: test
284 284 date: Thu Jan 01 00:00:00 1970 +0000
285 285 summary: another change for branch stable
286 286
287 287
288 288 $ rm -r ua
289 289
290 290
291 291 Testing default checkout:
292 292
293 293 $ hg clone a ua
294 294 updating to branch default
295 295 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
296 296
297 297 Repo ua has both heads:
298 298
299 299 $ hg -R ua heads
300 300 changeset: 15:0aae7cf88f0d
301 301 branch: stable
302 302 tag: tip
303 303 user: test
304 304 date: Thu Jan 01 00:00:00 1970 +0000
305 305 summary: another change for branch stable
306 306
307 307 changeset: 12:f21241060d6a
308 308 user: test
309 309 date: Thu Jan 01 00:00:00 1970 +0000
310 310 summary: hacked default
311 311
312 312
313 313 Branch 'default' is checked out:
314 314
315 315 $ hg -R ua parents
316 316 changeset: 12:f21241060d6a
317 317 user: test
318 318 date: Thu Jan 01 00:00:00 1970 +0000
319 319 summary: hacked default
320 320
321 321 Test clone with a branch named "@" (issue3677)
322 322
323 323 $ hg -R ua branch @
324 324 marked working directory as branch @
325 325 (branches are permanent and global, did you want a bookmark?)
326 326 $ hg -R ua commit -m 'created branch @'
327 327 $ hg clone ua atbranch
328 328 updating to branch default
329 329 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
330 330 $ hg -R atbranch heads
331 331 changeset: 16:798b6d97153e
332 332 branch: @
333 333 tag: tip
334 334 parent: 12:f21241060d6a
335 335 user: test
336 336 date: Thu Jan 01 00:00:00 1970 +0000
337 337 summary: created branch @
338 338
339 339 changeset: 15:0aae7cf88f0d
340 340 branch: stable
341 341 user: test
342 342 date: Thu Jan 01 00:00:00 1970 +0000
343 343 summary: another change for branch stable
344 344
345 345 changeset: 12:f21241060d6a
346 346 user: test
347 347 date: Thu Jan 01 00:00:00 1970 +0000
348 348 summary: hacked default
349 349
350 350 $ hg -R atbranch parents
351 351 changeset: 12:f21241060d6a
352 352 user: test
353 353 date: Thu Jan 01 00:00:00 1970 +0000
354 354 summary: hacked default
355 355
356 356
357 357 $ rm -r ua atbranch
358 358
359 359
360 360 Testing #<branch>:
361 361
362 362 $ hg clone -u . a#stable ua
363 363 adding changesets
364 364 adding manifests
365 365 adding file changes
366 366 added 14 changesets with 14 changes to 3 files
367 367 updating to branch stable
368 368 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
369 369
370 370 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
371 371
372 372 $ hg -R ua heads
373 373 changeset: 13:0aae7cf88f0d
374 374 branch: stable
375 375 tag: tip
376 376 user: test
377 377 date: Thu Jan 01 00:00:00 1970 +0000
378 378 summary: another change for branch stable
379 379
380 380 changeset: 10:a7949464abda
381 381 user: test
382 382 date: Thu Jan 01 00:00:00 1970 +0000
383 383 summary: test
384 384
385 385
386 386 Same revision checked out in repo a and ua:
387 387
388 388 $ hg -R a parents --template "{node|short}\n"
389 389 e8ece76546a6
390 390 $ hg -R ua parents --template "{node|short}\n"
391 391 e8ece76546a6
392 392
393 393 $ rm -r ua
394 394
395 395
396 396 Testing -u -r <branch>:
397 397
398 398 $ hg clone -u . -r stable a ua
399 399 adding changesets
400 400 adding manifests
401 401 adding file changes
402 402 added 14 changesets with 14 changes to 3 files
403 403 updating to branch stable
404 404 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
405 405
406 406 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
407 407
408 408 $ hg -R ua heads
409 409 changeset: 13:0aae7cf88f0d
410 410 branch: stable
411 411 tag: tip
412 412 user: test
413 413 date: Thu Jan 01 00:00:00 1970 +0000
414 414 summary: another change for branch stable
415 415
416 416 changeset: 10:a7949464abda
417 417 user: test
418 418 date: Thu Jan 01 00:00:00 1970 +0000
419 419 summary: test
420 420
421 421
422 422 Same revision checked out in repo a and ua:
423 423
424 424 $ hg -R a parents --template "{node|short}\n"
425 425 e8ece76546a6
426 426 $ hg -R ua parents --template "{node|short}\n"
427 427 e8ece76546a6
428 428
429 429 $ rm -r ua
430 430
431 431
432 432 Testing -r <branch>:
433 433
434 434 $ hg clone -r stable a ua
435 435 adding changesets
436 436 adding manifests
437 437 adding file changes
438 438 added 14 changesets with 14 changes to 3 files
439 439 updating to branch stable
440 440 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
441 441
442 442 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
443 443
444 444 $ hg -R ua heads
445 445 changeset: 13:0aae7cf88f0d
446 446 branch: stable
447 447 tag: tip
448 448 user: test
449 449 date: Thu Jan 01 00:00:00 1970 +0000
450 450 summary: another change for branch stable
451 451
452 452 changeset: 10:a7949464abda
453 453 user: test
454 454 date: Thu Jan 01 00:00:00 1970 +0000
455 455 summary: test
456 456
457 457
458 458 Branch 'stable' is checked out:
459 459
460 460 $ hg -R ua parents
461 461 changeset: 13:0aae7cf88f0d
462 462 branch: stable
463 463 tag: tip
464 464 user: test
465 465 date: Thu Jan 01 00:00:00 1970 +0000
466 466 summary: another change for branch stable
467 467
468 468
469 469 $ rm -r ua
470 470
471 471
472 472 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
473 473 iterable in addbranchrevs()
474 474
475 475 $ cat <<EOF > simpleclone.py
476 476 > from mercurial import ui, hg
477 477 > myui = ui.ui()
478 478 > repo = hg.repository(myui, 'a')
479 479 > hg.clone(myui, {}, repo, dest="ua")
480 480 > EOF
481 481
482 482 $ python simpleclone.py
483 483 updating to branch default
484 484 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
485 485
486 486 $ rm -r ua
487 487
488 488 $ cat <<EOF > branchclone.py
489 489 > from mercurial import ui, hg, extensions
490 490 > myui = ui.ui()
491 491 > extensions.loadall(myui)
492 492 > repo = hg.repository(myui, 'a')
493 493 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
494 494 > EOF
495 495
496 496 $ python branchclone.py
497 497 adding changesets
498 498 adding manifests
499 499 adding file changes
500 500 added 14 changesets with 14 changes to 3 files
501 501 updating to branch stable
502 502 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
503 503 $ rm -r ua
504 504
505 505
506 506 Test clone with special '@' bookmark:
507 507 $ cd a
508 508 $ hg bookmark -r a7949464abda @ # branch point of stable from default
509 509 $ hg clone . ../i
510 510 updating to branch default
511 511 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
512 512 $ hg id -i ../i
513 513 a7949464abda
514 $ cd "$TESTTMP"
514 515
515 516
516 517 Testing failures:
517 518
518 519 $ mkdir fail
519 520 $ cd fail
520 521
521 522 No local source
522 523
523 524 $ hg clone a b
524 525 abort: repository a not found!
525 526 [255]
526 527
527 528 No remote source
528 529
529 530 $ hg clone http://127.0.0.1:3121/a b
530 531 abort: error: *refused* (glob)
531 532 [255]
532 533 $ rm -rf b # work around bug with http clone
533 534
534 535
535 536 #if unix-permissions
536 537
537 538 Inaccessible source
538 539
539 540 $ mkdir a
540 541 $ chmod 000 a
541 542 $ hg clone a b
542 543 abort: repository a not found!
543 544 [255]
544 545
545 546 Inaccessible destination
546 547
547 548 $ hg init b
548 549 $ cd b
549 550 $ hg clone . ../a
550 551 abort: Permission denied: ../a
551 552 [255]
552 553 $ cd ..
553 554 $ chmod 700 a
554 555 $ rm -r a b
555 556
556 557 #endif
557 558
558 559
559 560 #if fifo
560 561
561 562 Source of wrong type
562 563
563 564 $ mkfifo a
564 565 $ hg clone a b
565 566 abort: repository a not found!
566 567 [255]
567 568 $ rm a
568 569
569 570 #endif
570 571
571 572 Default destination, same directory
572 573
573 574 $ hg init q
574 575 $ hg clone q
575 576 destination directory: q
576 577 abort: destination 'q' is not empty
577 578 [255]
578 579
579 580 destination directory not empty
580 581
581 582 $ mkdir a
582 583 $ echo stuff > a/a
583 584 $ hg clone q a
584 585 abort: destination 'a' is not empty
585 586 [255]
586 587
587 588
588 589 #if unix-permissions
589 590
590 591 leave existing directory in place after clone failure
591 592
592 593 $ hg init c
593 594 $ cd c
594 595 $ echo c > c
595 596 $ hg commit -A -m test
596 597 adding c
597 598 $ chmod -rx .hg/store/data
598 599 $ cd ..
599 600 $ mkdir d
600 601 $ hg clone c d 2> err
601 602 [255]
602 603 $ test -d d
603 604 $ test -d d/.hg
604 605 [1]
605 606
606 607 re-enable perm to allow deletion
607 608
608 609 $ chmod +rx c/.hg/store/data
609 610
610 611 #endif
611 612
612 613 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now