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