##// END OF EJS Templates
tests: conditionalize test output for simple store...
Gregory Szorc -
r37365:e82a59bf default
parent child Browse files
Show More
@@ -1,1273 +1,1295 b''
1 1 #testcases sshv1 sshv2
2 2
3 3 #if sshv2
4 4 $ cat >> $HGRCPATH << EOF
5 5 > [experimental]
6 6 > sshpeer.advertise-v2 = true
7 7 > sshserver.support-v2 = true
8 8 > EOF
9 9 #endif
10 10
11 11 Prepare repo a:
12 12
13 13 $ hg init a
14 14 $ cd a
15 15 $ echo a > a
16 16 $ hg add a
17 17 $ hg commit -m test
18 18 $ echo first line > b
19 19 $ hg add b
20 20
21 21 Create a non-inlined filelog:
22 22
23 23 $ $PYTHON -c 'open("data1", "wb").write(b"".join(b"%d\n" % x for x in range(10000)))'
24 24 $ for j in 0 1 2 3 4 5 6 7 8 9; do
25 25 > cat data1 >> b
26 26 > hg commit -m test
27 27 > done
28 28
29 29 List files in store/data (should show a 'b.d'):
30 30
31 31 #if reporevlogstore
32 32 $ for i in .hg/store/data/*; do
33 33 > echo $i
34 34 > done
35 35 .hg/store/data/a.i
36 36 .hg/store/data/b.d
37 37 .hg/store/data/b.i
38 38 #endif
39 39
40 40 Trigger branchcache creation:
41 41
42 42 $ hg branches
43 43 default 10:a7949464abda
44 44 $ ls .hg/cache
45 45 branch2-served
46 46 checkisexec (execbit !)
47 47 checklink (symlink !)
48 48 checklink-target (symlink !)
49 49 checknoexec (execbit !)
50 50 rbc-names-v1
51 51 rbc-revs-v1
52 52
53 53 Default operation:
54 54
55 55 $ hg clone . ../b
56 56 updating to branch default
57 57 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
58 58 $ cd ../b
59 59
60 60 Ensure branchcache got copied over:
61 61
62 62 $ ls .hg/cache
63 63 branch2-served
64 64 checkisexec (execbit !)
65 65 checklink (symlink !)
66 66 checklink-target (symlink !)
67 67 rbc-names-v1
68 68 rbc-revs-v1
69 69
70 70 $ cat a
71 71 a
72 72 $ hg verify
73 73 checking changesets
74 74 checking manifests
75 75 crosschecking files in changesets and manifests
76 76 checking files
77 77 2 files, 11 changesets, 11 total revisions
78 78
79 79 Invalid dest '' must abort:
80 80
81 81 $ hg clone . ''
82 82 abort: empty destination path is not valid
83 83 [255]
84 84
85 85 No update, with debug option:
86 86
87 87 #if hardlink
88 88 $ hg --debug clone -U . ../c --config progress.debug=true
89 89 linking: 1
90 90 linking: 2
91 91 linking: 3
92 92 linking: 4
93 93 linking: 5
94 94 linking: 6
95 95 linking: 7
96 96 linking: 8
97 linked 8 files
97 linked 8 files (reporevlogstore !)
98 linking: 9 (reposimplestore !)
99 linking: 10 (reposimplestore !)
100 linking: 11 (reposimplestore !)
101 linking: 12 (reposimplestore !)
102 linking: 13 (reposimplestore !)
103 linking: 14 (reposimplestore !)
104 linking: 15 (reposimplestore !)
105 linking: 16 (reposimplestore !)
106 linking: 17 (reposimplestore !)
107 linking: 18 (reposimplestore !)
108 linked 18 files (reposimplestore !)
98 109 #else
99 110 $ hg --debug clone -U . ../c --config progress.debug=true
100 111 linking: 1
101 112 copying: 2
102 113 copying: 3
103 114 copying: 4
104 115 copying: 5
105 116 copying: 6
106 117 copying: 7
107 118 copying: 8
108 copied 8 files
119 copied 8 files (reporevlogstore !)
120 copying: 9 (reposimplestore !)
121 copying: 10 (reposimplestore !)
122 copying: 11 (reposimplestore !)
123 copying: 12 (reposimplestore !)
124 copying: 13 (reposimplestore !)
125 copying: 14 (reposimplestore !)
126 copying: 15 (reposimplestore !)
127 copying: 16 (reposimplestore !)
128 copying: 17 (reposimplestore !)
129 copying: 18 (reposimplestore !)
130 copied 18 files (reposimplestore !)
109 131 #endif
110 132 $ cd ../c
111 133
112 134 Ensure branchcache got copied over:
113 135
114 136 $ ls .hg/cache
115 137 branch2-served
116 138 rbc-names-v1
117 139 rbc-revs-v1
118 140
119 141 $ cat a 2>/dev/null || echo "a not present"
120 142 a not present
121 143 $ hg verify
122 144 checking changesets
123 145 checking manifests
124 146 crosschecking files in changesets and manifests
125 147 checking files
126 148 2 files, 11 changesets, 11 total revisions
127 149
128 150 Default destination:
129 151
130 152 $ mkdir ../d
131 153 $ cd ../d
132 154 $ hg clone ../a
133 155 destination directory: a
134 156 updating to branch default
135 157 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
136 158 $ cd a
137 159 $ hg cat a
138 160 a
139 161 $ cd ../..
140 162
141 163 Check that we drop the 'file:' from the path before writing the .hgrc:
142 164
143 165 $ hg clone file:a e
144 166 updating to branch default
145 167 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
146 168 $ grep 'file:' e/.hg/hgrc
147 169 [1]
148 170
149 171 Check that path aliases are expanded:
150 172
151 173 $ hg clone -q -U --config 'paths.foobar=a#0' foobar f
152 174 $ hg -R f showconfig paths.default
153 175 $TESTTMP/a#0
154 176
155 177 Use --pull:
156 178
157 179 $ hg clone --pull a g
158 180 requesting all changes
159 181 adding changesets
160 182 adding manifests
161 183 adding file changes
162 184 added 11 changesets with 11 changes to 2 files
163 185 new changesets acb14030fe0a:a7949464abda
164 186 updating to branch default
165 187 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
166 188 $ hg -R g verify
167 189 checking changesets
168 190 checking manifests
169 191 crosschecking files in changesets and manifests
170 192 checking files
171 193 2 files, 11 changesets, 11 total revisions
172 194
173 195 Invalid dest '' with --pull must abort (issue2528):
174 196
175 197 $ hg clone --pull a ''
176 198 abort: empty destination path is not valid
177 199 [255]
178 200
179 201 Clone to '.':
180 202
181 203 $ mkdir h
182 204 $ cd h
183 205 $ hg clone ../a .
184 206 updating to branch default
185 207 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
186 208 $ cd ..
187 209
188 210
189 211 *** Tests for option -u ***
190 212
191 213 Adding some more history to repo a:
192 214
193 215 $ cd a
194 216 $ hg tag ref1
195 217 $ echo the quick brown fox >a
196 218 $ hg ci -m "hacked default"
197 219 $ hg up ref1
198 220 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
199 221 $ hg branch stable
200 222 marked working directory as branch stable
201 223 (branches are permanent and global, did you want a bookmark?)
202 224 $ echo some text >a
203 225 $ hg ci -m "starting branch stable"
204 226 $ hg tag ref2
205 227 $ echo some more text >a
206 228 $ hg ci -m "another change for branch stable"
207 229 $ hg up ref2
208 230 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
209 231 $ hg parents
210 232 changeset: 13:e8ece76546a6
211 233 branch: stable
212 234 tag: ref2
213 235 parent: 10:a7949464abda
214 236 user: test
215 237 date: Thu Jan 01 00:00:00 1970 +0000
216 238 summary: starting branch stable
217 239
218 240
219 241 Repo a has two heads:
220 242
221 243 $ hg heads
222 244 changeset: 15:0aae7cf88f0d
223 245 branch: stable
224 246 tag: tip
225 247 user: test
226 248 date: Thu Jan 01 00:00:00 1970 +0000
227 249 summary: another change for branch stable
228 250
229 251 changeset: 12:f21241060d6a
230 252 user: test
231 253 date: Thu Jan 01 00:00:00 1970 +0000
232 254 summary: hacked default
233 255
234 256
235 257 $ cd ..
236 258
237 259
238 260 Testing --noupdate with --updaterev (must abort):
239 261
240 262 $ hg clone --noupdate --updaterev 1 a ua
241 263 abort: cannot specify both --noupdate and --updaterev
242 264 [255]
243 265
244 266
245 267 Testing clone -u:
246 268
247 269 $ hg clone -u . a ua
248 270 updating to branch stable
249 271 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
250 272
251 273 Repo ua has both heads:
252 274
253 275 $ hg -R ua heads
254 276 changeset: 15:0aae7cf88f0d
255 277 branch: stable
256 278 tag: tip
257 279 user: test
258 280 date: Thu Jan 01 00:00:00 1970 +0000
259 281 summary: another change for branch stable
260 282
261 283 changeset: 12:f21241060d6a
262 284 user: test
263 285 date: Thu Jan 01 00:00:00 1970 +0000
264 286 summary: hacked default
265 287
266 288
267 289 Same revision checked out in repo a and ua:
268 290
269 291 $ hg -R a parents --template "{node|short}\n"
270 292 e8ece76546a6
271 293 $ hg -R ua parents --template "{node|short}\n"
272 294 e8ece76546a6
273 295
274 296 $ rm -r ua
275 297
276 298
277 299 Testing clone --pull -u:
278 300
279 301 $ hg clone --pull -u . a ua
280 302 requesting all changes
281 303 adding changesets
282 304 adding manifests
283 305 adding file changes
284 306 added 16 changesets with 16 changes to 3 files (+1 heads)
285 307 new changesets acb14030fe0a:0aae7cf88f0d
286 308 updating to branch stable
287 309 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
288 310
289 311 Repo ua has both heads:
290 312
291 313 $ hg -R ua heads
292 314 changeset: 15:0aae7cf88f0d
293 315 branch: stable
294 316 tag: tip
295 317 user: test
296 318 date: Thu Jan 01 00:00:00 1970 +0000
297 319 summary: another change for branch stable
298 320
299 321 changeset: 12:f21241060d6a
300 322 user: test
301 323 date: Thu Jan 01 00:00:00 1970 +0000
302 324 summary: hacked default
303 325
304 326
305 327 Same revision checked out in repo a and ua:
306 328
307 329 $ hg -R a parents --template "{node|short}\n"
308 330 e8ece76546a6
309 331 $ hg -R ua parents --template "{node|short}\n"
310 332 e8ece76546a6
311 333
312 334 $ rm -r ua
313 335
314 336
315 337 Testing clone -u <branch>:
316 338
317 339 $ hg clone -u stable a ua
318 340 updating to branch stable
319 341 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 342
321 343 Repo ua has both heads:
322 344
323 345 $ hg -R ua heads
324 346 changeset: 15:0aae7cf88f0d
325 347 branch: stable
326 348 tag: tip
327 349 user: test
328 350 date: Thu Jan 01 00:00:00 1970 +0000
329 351 summary: another change for branch stable
330 352
331 353 changeset: 12:f21241060d6a
332 354 user: test
333 355 date: Thu Jan 01 00:00:00 1970 +0000
334 356 summary: hacked default
335 357
336 358
337 359 Branch 'stable' is checked out:
338 360
339 361 $ hg -R ua parents
340 362 changeset: 15:0aae7cf88f0d
341 363 branch: stable
342 364 tag: tip
343 365 user: test
344 366 date: Thu Jan 01 00:00:00 1970 +0000
345 367 summary: another change for branch stable
346 368
347 369
348 370 $ rm -r ua
349 371
350 372
351 373 Testing default checkout:
352 374
353 375 $ hg clone a ua
354 376 updating to branch default
355 377 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
356 378
357 379 Repo ua has both heads:
358 380
359 381 $ hg -R ua heads
360 382 changeset: 15:0aae7cf88f0d
361 383 branch: stable
362 384 tag: tip
363 385 user: test
364 386 date: Thu Jan 01 00:00:00 1970 +0000
365 387 summary: another change for branch stable
366 388
367 389 changeset: 12:f21241060d6a
368 390 user: test
369 391 date: Thu Jan 01 00:00:00 1970 +0000
370 392 summary: hacked default
371 393
372 394
373 395 Branch 'default' is checked out:
374 396
375 397 $ hg -R ua parents
376 398 changeset: 12:f21241060d6a
377 399 user: test
378 400 date: Thu Jan 01 00:00:00 1970 +0000
379 401 summary: hacked default
380 402
381 403 Test clone with a branch named "@" (issue3677)
382 404
383 405 $ hg -R ua branch @
384 406 marked working directory as branch @
385 407 $ hg -R ua commit -m 'created branch @'
386 408 $ hg clone ua atbranch
387 409 updating to branch default
388 410 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
389 411 $ hg -R atbranch heads
390 412 changeset: 16:798b6d97153e
391 413 branch: @
392 414 tag: tip
393 415 parent: 12:f21241060d6a
394 416 user: test
395 417 date: Thu Jan 01 00:00:00 1970 +0000
396 418 summary: created branch @
397 419
398 420 changeset: 15:0aae7cf88f0d
399 421 branch: stable
400 422 user: test
401 423 date: Thu Jan 01 00:00:00 1970 +0000
402 424 summary: another change for branch stable
403 425
404 426 changeset: 12:f21241060d6a
405 427 user: test
406 428 date: Thu Jan 01 00:00:00 1970 +0000
407 429 summary: hacked default
408 430
409 431 $ hg -R atbranch parents
410 432 changeset: 12:f21241060d6a
411 433 user: test
412 434 date: Thu Jan 01 00:00:00 1970 +0000
413 435 summary: hacked default
414 436
415 437
416 438 $ rm -r ua atbranch
417 439
418 440
419 441 Testing #<branch>:
420 442
421 443 $ hg clone -u . a#stable ua
422 444 adding changesets
423 445 adding manifests
424 446 adding file changes
425 447 added 14 changesets with 14 changes to 3 files
426 448 new changesets acb14030fe0a:0aae7cf88f0d
427 449 updating to branch stable
428 450 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
429 451
430 452 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
431 453
432 454 $ hg -R ua heads
433 455 changeset: 13:0aae7cf88f0d
434 456 branch: stable
435 457 tag: tip
436 458 user: test
437 459 date: Thu Jan 01 00:00:00 1970 +0000
438 460 summary: another change for branch stable
439 461
440 462 changeset: 10:a7949464abda
441 463 user: test
442 464 date: Thu Jan 01 00:00:00 1970 +0000
443 465 summary: test
444 466
445 467
446 468 Same revision checked out in repo a and ua:
447 469
448 470 $ hg -R a parents --template "{node|short}\n"
449 471 e8ece76546a6
450 472 $ hg -R ua parents --template "{node|short}\n"
451 473 e8ece76546a6
452 474
453 475 $ rm -r ua
454 476
455 477
456 478 Testing -u -r <branch>:
457 479
458 480 $ hg clone -u . -r stable a ua
459 481 adding changesets
460 482 adding manifests
461 483 adding file changes
462 484 added 14 changesets with 14 changes to 3 files
463 485 new changesets acb14030fe0a:0aae7cf88f0d
464 486 updating to branch stable
465 487 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
466 488
467 489 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
468 490
469 491 $ hg -R ua heads
470 492 changeset: 13:0aae7cf88f0d
471 493 branch: stable
472 494 tag: tip
473 495 user: test
474 496 date: Thu Jan 01 00:00:00 1970 +0000
475 497 summary: another change for branch stable
476 498
477 499 changeset: 10:a7949464abda
478 500 user: test
479 501 date: Thu Jan 01 00:00:00 1970 +0000
480 502 summary: test
481 503
482 504
483 505 Same revision checked out in repo a and ua:
484 506
485 507 $ hg -R a parents --template "{node|short}\n"
486 508 e8ece76546a6
487 509 $ hg -R ua parents --template "{node|short}\n"
488 510 e8ece76546a6
489 511
490 512 $ rm -r ua
491 513
492 514
493 515 Testing -r <branch>:
494 516
495 517 $ hg clone -r stable a ua
496 518 adding changesets
497 519 adding manifests
498 520 adding file changes
499 521 added 14 changesets with 14 changes to 3 files
500 522 new changesets acb14030fe0a:0aae7cf88f0d
501 523 updating to branch stable
502 524 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
503 525
504 526 Repo ua has branch 'stable' and 'default' (was changed in fd511e9eeea6):
505 527
506 528 $ hg -R ua heads
507 529 changeset: 13:0aae7cf88f0d
508 530 branch: stable
509 531 tag: tip
510 532 user: test
511 533 date: Thu Jan 01 00:00:00 1970 +0000
512 534 summary: another change for branch stable
513 535
514 536 changeset: 10:a7949464abda
515 537 user: test
516 538 date: Thu Jan 01 00:00:00 1970 +0000
517 539 summary: test
518 540
519 541
520 542 Branch 'stable' is checked out:
521 543
522 544 $ hg -R ua parents
523 545 changeset: 13:0aae7cf88f0d
524 546 branch: stable
525 547 tag: tip
526 548 user: test
527 549 date: Thu Jan 01 00:00:00 1970 +0000
528 550 summary: another change for branch stable
529 551
530 552
531 553 $ rm -r ua
532 554
533 555
534 556 Issue2267: Error in 1.6 hg.py: TypeError: 'NoneType' object is not
535 557 iterable in addbranchrevs()
536 558
537 559 $ cat <<EOF > simpleclone.py
538 560 > from mercurial import ui, hg
539 561 > myui = ui.ui.load()
540 562 > repo = hg.repository(myui, 'a')
541 563 > hg.clone(myui, {}, repo, dest="ua")
542 564 > EOF
543 565
544 566 $ $PYTHON simpleclone.py
545 567 updating to branch default
546 568 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
547 569
548 570 $ rm -r ua
549 571
550 572 $ cat <<EOF > branchclone.py
551 573 > from mercurial import ui, hg, extensions
552 574 > myui = ui.ui.load()
553 575 > extensions.loadall(myui)
554 576 > repo = hg.repository(myui, 'a')
555 577 > hg.clone(myui, {}, repo, dest="ua", branch=["stable",])
556 578 > EOF
557 579
558 580 $ $PYTHON branchclone.py
559 581 adding changesets
560 582 adding manifests
561 583 adding file changes
562 584 added 14 changesets with 14 changes to 3 files
563 585 new changesets acb14030fe0a:0aae7cf88f0d
564 586 updating to branch stable
565 587 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
566 588 $ rm -r ua
567 589
568 590
569 591 Test clone with special '@' bookmark:
570 592 $ cd a
571 593 $ hg bookmark -r a7949464abda @ # branch point of stable from default
572 594 $ hg clone . ../i
573 595 updating to bookmark @
574 596 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
575 597 $ hg id -i ../i
576 598 a7949464abda
577 599 $ rm -r ../i
578 600
579 601 $ hg bookmark -f -r stable @
580 602 $ hg bookmarks
581 603 @ 15:0aae7cf88f0d
582 604 $ hg clone . ../i
583 605 updating to bookmark @ on branch stable
584 606 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
585 607 $ hg id -i ../i
586 608 0aae7cf88f0d
587 609 $ cd "$TESTTMP"
588 610
589 611
590 612 Testing failures:
591 613
592 614 $ mkdir fail
593 615 $ cd fail
594 616
595 617 No local source
596 618
597 619 $ hg clone a b
598 620 abort: repository a not found!
599 621 [255]
600 622
601 623 No remote source
602 624
603 625 #if windows
604 626 $ hg clone http://$LOCALIP:3121/a b
605 627 abort: error: * (glob)
606 628 [255]
607 629 #else
608 630 $ hg clone http://$LOCALIP:3121/a b
609 631 abort: error: *refused* (glob)
610 632 [255]
611 633 #endif
612 634 $ rm -rf b # work around bug with http clone
613 635
614 636
615 637 #if unix-permissions no-root
616 638
617 639 Inaccessible source
618 640
619 641 $ mkdir a
620 642 $ chmod 000 a
621 643 $ hg clone a b
622 644 abort: repository a not found!
623 645 [255]
624 646
625 647 Inaccessible destination
626 648
627 649 $ hg init b
628 650 $ cd b
629 651 $ hg clone . ../a
630 652 abort: Permission denied: '../a'
631 653 [255]
632 654 $ cd ..
633 655 $ chmod 700 a
634 656 $ rm -r a b
635 657
636 658 #endif
637 659
638 660
639 661 #if fifo
640 662
641 663 Source of wrong type
642 664
643 665 $ mkfifo a
644 666 $ hg clone a b
645 667 abort: repository a not found!
646 668 [255]
647 669 $ rm a
648 670
649 671 #endif
650 672
651 673 Default destination, same directory
652 674
653 675 $ hg init q
654 676 $ hg clone q
655 677 destination directory: q
656 678 abort: destination 'q' is not empty
657 679 [255]
658 680
659 681 destination directory not empty
660 682
661 683 $ mkdir a
662 684 $ echo stuff > a/a
663 685 $ hg clone q a
664 686 abort: destination 'a' is not empty
665 687 [255]
666 688
667 689
668 690 #if unix-permissions no-root
669 691
670 692 leave existing directory in place after clone failure
671 693
672 694 $ hg init c
673 695 $ cd c
674 696 $ echo c > c
675 697 $ hg commit -A -m test
676 698 adding c
677 699 $ chmod -rx .hg/store/data
678 700 $ cd ..
679 701 $ mkdir d
680 702 $ hg clone c d 2> err
681 703 [255]
682 704 $ test -d d
683 705 $ test -d d/.hg
684 706 [1]
685 707
686 708 re-enable perm to allow deletion
687 709
688 710 $ chmod +rx c/.hg/store/data
689 711
690 712 #endif
691 713
692 714 $ cd ..
693 715
694 716 Test clone from the repository in (emulated) revlog format 0 (issue4203):
695 717
696 718 $ mkdir issue4203
697 719 $ mkdir -p src/.hg
698 720 $ echo foo > src/foo
699 721 $ hg -R src add src/foo
700 722 $ hg -R src commit -m '#0'
701 723 $ hg -R src log -q
702 724 0:e1bab28bca43
703 725 $ hg clone -U -q src dst
704 726 $ hg -R dst log -q
705 727 0:e1bab28bca43
706 728
707 729 Create repositories to test auto sharing functionality
708 730
709 731 $ cat >> $HGRCPATH << EOF
710 732 > [extensions]
711 733 > share=
712 734 > EOF
713 735
714 736 $ hg init empty
715 737 $ hg init source1a
716 738 $ cd source1a
717 739 $ echo initial1 > foo
718 740 $ hg -q commit -A -m initial
719 741 $ echo second > foo
720 742 $ hg commit -m second
721 743 $ cd ..
722 744
723 745 $ hg init filteredrev0
724 746 $ cd filteredrev0
725 747 $ cat >> .hg/hgrc << EOF
726 748 > [experimental]
727 749 > evolution.createmarkers=True
728 750 > EOF
729 751 $ echo initial1 > foo
730 752 $ hg -q commit -A -m initial0
731 753 $ hg -q up -r null
732 754 $ echo initial2 > foo
733 755 $ hg -q commit -A -m initial1
734 756 $ hg debugobsolete c05d5c47a5cf81401869999f3d05f7d699d2b29a e082c1832e09a7d1e78b7fd49a592d372de854c8
735 757 obsoleted 1 changesets
736 758 $ cd ..
737 759
738 760 $ hg -q clone --pull source1a source1b
739 761 $ cd source1a
740 762 $ hg bookmark bookA
741 763 $ echo 1a > foo
742 764 $ hg commit -m 1a
743 765 $ cd ../source1b
744 766 $ hg -q up -r 0
745 767 $ echo head1 > foo
746 768 $ hg commit -m head1
747 769 created new head
748 770 $ hg bookmark head1
749 771 $ hg -q up -r 0
750 772 $ echo head2 > foo
751 773 $ hg commit -m head2
752 774 created new head
753 775 $ hg bookmark head2
754 776 $ hg -q up -r 0
755 777 $ hg branch branch1
756 778 marked working directory as branch branch1
757 779 (branches are permanent and global, did you want a bookmark?)
758 780 $ echo branch1 > foo
759 781 $ hg commit -m branch1
760 782 $ hg -q up -r 0
761 783 $ hg branch branch2
762 784 marked working directory as branch branch2
763 785 $ echo branch2 > foo
764 786 $ hg commit -m branch2
765 787 $ cd ..
766 788 $ hg init source2
767 789 $ cd source2
768 790 $ echo initial2 > foo
769 791 $ hg -q commit -A -m initial2
770 792 $ echo second > foo
771 793 $ hg commit -m second
772 794 $ cd ..
773 795
774 796 Clone with auto share from an empty repo should not result in share
775 797
776 798 $ mkdir share
777 799 $ hg --config share.pool=share clone empty share-empty
778 800 (not using pooled storage: remote appears to be empty)
779 801 updating to branch default
780 802 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
781 803 $ ls share
782 804 $ test -d share-empty/.hg/store
783 805 $ test -f share-empty/.hg/sharedpath
784 806 [1]
785 807
786 808 Clone with auto share from a repo with filtered revision 0 should not result in share
787 809
788 810 $ hg --config share.pool=share clone filteredrev0 share-filtered
789 811 (not using pooled storage: unable to resolve identity of remote)
790 812 requesting all changes
791 813 adding changesets
792 814 adding manifests
793 815 adding file changes
794 816 added 1 changesets with 1 changes to 1 files
795 817 new changesets e082c1832e09
796 818 updating to branch default
797 819 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
798 820
799 821 Clone from repo with content should result in shared store being created
800 822
801 823 $ hg --config share.pool=share clone source1a share-dest1a
802 824 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
803 825 requesting all changes
804 826 adding changesets
805 827 adding manifests
806 828 adding file changes
807 829 added 3 changesets with 3 changes to 1 files
808 830 new changesets b5f04eac9d8f:e5bfe23c0b47
809 831 searching for changes
810 832 no changes found
811 833 adding remote bookmark bookA
812 834 updating working directory
813 835 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
814 836
815 837 The shared repo should have been created
816 838
817 839 $ ls share
818 840 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
819 841
820 842 The destination should point to it
821 843
822 844 $ cat share-dest1a/.hg/sharedpath; echo
823 845 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
824 846
825 847 The destination should have bookmarks
826 848
827 849 $ hg -R share-dest1a bookmarks
828 850 bookA 2:e5bfe23c0b47
829 851
830 852 The default path should be the remote, not the share
831 853
832 854 $ hg -R share-dest1a config paths.default
833 855 $TESTTMP/source1a
834 856
835 857 Clone with existing share dir should result in pull + share
836 858
837 859 $ hg --config share.pool=share clone source1b share-dest1b
838 860 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
839 861 searching for changes
840 862 adding changesets
841 863 adding manifests
842 864 adding file changes
843 865 added 4 changesets with 4 changes to 1 files (+4 heads)
844 866 adding remote bookmark head1
845 867 adding remote bookmark head2
846 868 new changesets 4a8dc1ab4c13:6bacf4683960
847 869 updating working directory
848 870 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
849 871
850 872 $ ls share
851 873 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
852 874
853 875 $ cat share-dest1b/.hg/sharedpath; echo
854 876 $TESTTMP/share/b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1/.hg
855 877
856 878 We only get bookmarks from the remote, not everything in the share
857 879
858 880 $ hg -R share-dest1b bookmarks
859 881 head1 3:4a8dc1ab4c13
860 882 head2 4:99f71071f117
861 883
862 884 Default path should be source, not share.
863 885
864 886 $ hg -R share-dest1b config paths.default
865 887 $TESTTMP/source1b
866 888
867 889 Checked out revision should be head of default branch
868 890
869 891 $ hg -R share-dest1b log -r .
870 892 changeset: 4:99f71071f117
871 893 bookmark: head2
872 894 parent: 0:b5f04eac9d8f
873 895 user: test
874 896 date: Thu Jan 01 00:00:00 1970 +0000
875 897 summary: head2
876 898
877 899
878 900 Clone from unrelated repo should result in new share
879 901
880 902 $ hg --config share.pool=share clone source2 share-dest2
881 903 (sharing from new pooled repository 22aeff664783fd44c6d9b435618173c118c3448e)
882 904 requesting all changes
883 905 adding changesets
884 906 adding manifests
885 907 adding file changes
886 908 added 2 changesets with 2 changes to 1 files
887 909 new changesets 22aeff664783:63cf6c3dba4a
888 910 searching for changes
889 911 no changes found
890 912 updating working directory
891 913 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
892 914
893 915 $ ls share
894 916 22aeff664783fd44c6d9b435618173c118c3448e
895 917 b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1
896 918
897 919 remote naming mode works as advertised
898 920
899 921 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1a share-remote1a
900 922 (sharing from new pooled repository 195bb1fcdb595c14a6c13e0269129ed78f6debde)
901 923 requesting all changes
902 924 adding changesets
903 925 adding manifests
904 926 adding file changes
905 927 added 3 changesets with 3 changes to 1 files
906 928 new changesets b5f04eac9d8f:e5bfe23c0b47
907 929 searching for changes
908 930 no changes found
909 931 adding remote bookmark bookA
910 932 updating working directory
911 933 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
912 934
913 935 $ ls shareremote
914 936 195bb1fcdb595c14a6c13e0269129ed78f6debde
915 937
916 938 $ hg --config share.pool=shareremote --config share.poolnaming=remote clone source1b share-remote1b
917 939 (sharing from new pooled repository c0d4f83847ca2a873741feb7048a45085fd47c46)
918 940 requesting all changes
919 941 adding changesets
920 942 adding manifests
921 943 adding file changes
922 944 added 6 changesets with 6 changes to 1 files (+4 heads)
923 945 new changesets b5f04eac9d8f:6bacf4683960
924 946 searching for changes
925 947 no changes found
926 948 adding remote bookmark head1
927 949 adding remote bookmark head2
928 950 updating working directory
929 951 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
930 952
931 953 $ ls shareremote
932 954 195bb1fcdb595c14a6c13e0269129ed78f6debde
933 955 c0d4f83847ca2a873741feb7048a45085fd47c46
934 956
935 957 request to clone a single revision is respected in sharing mode
936 958
937 959 $ hg --config share.pool=sharerevs clone -r 4a8dc1ab4c13 source1b share-1arev
938 960 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
939 961 adding changesets
940 962 adding manifests
941 963 adding file changes
942 964 added 2 changesets with 2 changes to 1 files
943 965 new changesets b5f04eac9d8f:4a8dc1ab4c13
944 966 no changes found
945 967 adding remote bookmark head1
946 968 updating working directory
947 969 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
948 970
949 971 $ hg -R share-1arev log -G
950 972 @ changeset: 1:4a8dc1ab4c13
951 973 | bookmark: head1
952 974 | tag: tip
953 975 | user: test
954 976 | date: Thu Jan 01 00:00:00 1970 +0000
955 977 | summary: head1
956 978 |
957 979 o changeset: 0:b5f04eac9d8f
958 980 user: test
959 981 date: Thu Jan 01 00:00:00 1970 +0000
960 982 summary: initial
961 983
962 984
963 985 making another clone should only pull down requested rev
964 986
965 987 $ hg --config share.pool=sharerevs clone -r 99f71071f117 source1b share-1brev
966 988 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
967 989 searching for changes
968 990 adding changesets
969 991 adding manifests
970 992 adding file changes
971 993 added 1 changesets with 1 changes to 1 files (+1 heads)
972 994 adding remote bookmark head1
973 995 adding remote bookmark head2
974 996 new changesets 99f71071f117
975 997 updating working directory
976 998 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
977 999
978 1000 $ hg -R share-1brev log -G
979 1001 @ changeset: 2:99f71071f117
980 1002 | bookmark: head2
981 1003 | tag: tip
982 1004 | parent: 0:b5f04eac9d8f
983 1005 | user: test
984 1006 | date: Thu Jan 01 00:00:00 1970 +0000
985 1007 | summary: head2
986 1008 |
987 1009 | o changeset: 1:4a8dc1ab4c13
988 1010 |/ bookmark: head1
989 1011 | user: test
990 1012 | date: Thu Jan 01 00:00:00 1970 +0000
991 1013 | summary: head1
992 1014 |
993 1015 o changeset: 0:b5f04eac9d8f
994 1016 user: test
995 1017 date: Thu Jan 01 00:00:00 1970 +0000
996 1018 summary: initial
997 1019
998 1020
999 1021 Request to clone a single branch is respected in sharing mode
1000 1022
1001 1023 $ hg --config share.pool=sharebranch clone -b branch1 source1b share-1bbranch1
1002 1024 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1003 1025 adding changesets
1004 1026 adding manifests
1005 1027 adding file changes
1006 1028 added 2 changesets with 2 changes to 1 files
1007 1029 new changesets b5f04eac9d8f:5f92a6c1a1b1
1008 1030 no changes found
1009 1031 updating working directory
1010 1032 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1011 1033
1012 1034 $ hg -R share-1bbranch1 log -G
1013 1035 o changeset: 1:5f92a6c1a1b1
1014 1036 | branch: branch1
1015 1037 | tag: tip
1016 1038 | user: test
1017 1039 | date: Thu Jan 01 00:00:00 1970 +0000
1018 1040 | summary: branch1
1019 1041 |
1020 1042 @ changeset: 0:b5f04eac9d8f
1021 1043 user: test
1022 1044 date: Thu Jan 01 00:00:00 1970 +0000
1023 1045 summary: initial
1024 1046
1025 1047
1026 1048 $ hg --config share.pool=sharebranch clone -b branch2 source1b share-1bbranch2
1027 1049 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1028 1050 searching for changes
1029 1051 adding changesets
1030 1052 adding manifests
1031 1053 adding file changes
1032 1054 added 1 changesets with 1 changes to 1 files (+1 heads)
1033 1055 new changesets 6bacf4683960
1034 1056 updating working directory
1035 1057 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1036 1058
1037 1059 $ hg -R share-1bbranch2 log -G
1038 1060 o changeset: 2:6bacf4683960
1039 1061 | branch: branch2
1040 1062 | tag: tip
1041 1063 | parent: 0:b5f04eac9d8f
1042 1064 | user: test
1043 1065 | date: Thu Jan 01 00:00:00 1970 +0000
1044 1066 | summary: branch2
1045 1067 |
1046 1068 | o changeset: 1:5f92a6c1a1b1
1047 1069 |/ branch: branch1
1048 1070 | user: test
1049 1071 | date: Thu Jan 01 00:00:00 1970 +0000
1050 1072 | summary: branch1
1051 1073 |
1052 1074 @ changeset: 0:b5f04eac9d8f
1053 1075 user: test
1054 1076 date: Thu Jan 01 00:00:00 1970 +0000
1055 1077 summary: initial
1056 1078
1057 1079
1058 1080 -U is respected in share clone mode
1059 1081
1060 1082 $ hg --config share.pool=share clone -U source1a share-1anowc
1061 1083 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1062 1084 searching for changes
1063 1085 no changes found
1064 1086 adding remote bookmark bookA
1065 1087
1066 1088 $ ls share-1anowc
1067 1089
1068 1090 Test that auto sharing doesn't cause failure of "hg clone local remote"
1069 1091
1070 1092 $ cd $TESTTMP
1071 1093 $ hg -R a id -r 0
1072 1094 acb14030fe0a
1073 1095 $ hg id -R remote -r 0
1074 1096 abort: repository remote not found!
1075 1097 [255]
1076 1098 $ hg --config share.pool=share -q clone -e "\"$PYTHON\" \"$TESTDIR/dummyssh\"" a ssh://user@dummy/remote
1077 1099 $ hg -R remote id -r 0
1078 1100 acb14030fe0a
1079 1101
1080 1102 Cloning into pooled storage doesn't race (issue5104)
1081 1103
1082 1104 $ HGPOSTLOCKDELAY=2.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace1 > race1.log 2>&1 &
1083 1105 $ HGPRELOCKDELAY=1.0 hg --config share.pool=racepool --config extensions.lockdelay=$TESTDIR/lockdelay.py clone source1a share-destrace2 > race2.log 2>&1
1084 1106 $ wait
1085 1107
1086 1108 $ hg -R share-destrace1 log -r tip
1087 1109 changeset: 2:e5bfe23c0b47
1088 1110 bookmark: bookA
1089 1111 tag: tip
1090 1112 user: test
1091 1113 date: Thu Jan 01 00:00:00 1970 +0000
1092 1114 summary: 1a
1093 1115
1094 1116
1095 1117 $ hg -R share-destrace2 log -r tip
1096 1118 changeset: 2:e5bfe23c0b47
1097 1119 bookmark: bookA
1098 1120 tag: tip
1099 1121 user: test
1100 1122 date: Thu Jan 01 00:00:00 1970 +0000
1101 1123 summary: 1a
1102 1124
1103 1125 One repo should be new, the other should be shared from the pool. We
1104 1126 don't care which is which, so we just make sure we always print the
1105 1127 one containing "new pooled" first, then one one containing "existing
1106 1128 pooled".
1107 1129
1108 1130 $ (grep 'new pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1109 1131 (sharing from new pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1110 1132 requesting all changes
1111 1133 adding changesets
1112 1134 adding manifests
1113 1135 adding file changes
1114 1136 added 3 changesets with 3 changes to 1 files
1115 1137 new changesets b5f04eac9d8f:e5bfe23c0b47
1116 1138 searching for changes
1117 1139 no changes found
1118 1140 adding remote bookmark bookA
1119 1141 updating working directory
1120 1142 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1121 1143
1122 1144 $ (grep 'existing pooled' race1.log > /dev/null && cat race1.log || cat race2.log) | grep -v lock
1123 1145 (sharing from existing pooled repository b5f04eac9d8f7a6a9fcb070243cccea7dc5ea0c1)
1124 1146 searching for changes
1125 1147 no changes found
1126 1148 adding remote bookmark bookA
1127 1149 updating working directory
1128 1150 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1129 1151
1130 1152 SEC: check for unsafe ssh url
1131 1153
1132 1154 $ cat >> $HGRCPATH << EOF
1133 1155 > [ui]
1134 1156 > ssh = sh -c "read l; read l; read l"
1135 1157 > EOF
1136 1158
1137 1159 $ hg clone 'ssh://-oProxyCommand=touch${IFS}owned/path'
1138 1160 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1139 1161 [255]
1140 1162 $ hg clone 'ssh://%2DoProxyCommand=touch${IFS}owned/path'
1141 1163 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch${IFS}owned/path'
1142 1164 [255]
1143 1165 $ hg clone 'ssh://fakehost|touch%20owned/path'
1144 1166 abort: no suitable response from remote hg!
1145 1167 [255]
1146 1168 $ hg clone 'ssh://fakehost%7Ctouch%20owned/path'
1147 1169 abort: no suitable response from remote hg!
1148 1170 [255]
1149 1171
1150 1172 $ hg clone 'ssh://-oProxyCommand=touch owned%20foo@example.com/nonexistent/path'
1151 1173 abort: potentially unsafe url: 'ssh://-oProxyCommand=touch owned foo@example.com/nonexistent/path'
1152 1174 [255]
1153 1175
1154 1176 #if windows
1155 1177 $ hg clone "ssh://%26touch%20owned%20/" --debug
1156 1178 running sh -c "read l; read l; read l" "&touch owned " "hg -R . serve --stdio"
1157 1179 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1158 1180 sending hello command
1159 1181 sending between command
1160 1182 abort: no suitable response from remote hg!
1161 1183 [255]
1162 1184 $ hg clone "ssh://example.com:%26touch%20owned%20/" --debug
1163 1185 running sh -c "read l; read l; read l" -p "&touch owned " example.com "hg -R . serve --stdio"
1164 1186 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1165 1187 sending hello command
1166 1188 sending between command
1167 1189 abort: no suitable response from remote hg!
1168 1190 [255]
1169 1191 #else
1170 1192 $ hg clone "ssh://%3btouch%20owned%20/" --debug
1171 1193 running sh -c "read l; read l; read l" ';touch owned ' 'hg -R . serve --stdio'
1172 1194 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1173 1195 sending hello command
1174 1196 sending between command
1175 1197 abort: no suitable response from remote hg!
1176 1198 [255]
1177 1199 $ hg clone "ssh://example.com:%3btouch%20owned%20/" --debug
1178 1200 running sh -c "read l; read l; read l" -p ';touch owned ' example.com 'hg -R . serve --stdio'
1179 1201 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1180 1202 sending hello command
1181 1203 sending between command
1182 1204 abort: no suitable response from remote hg!
1183 1205 [255]
1184 1206 #endif
1185 1207
1186 1208 $ hg clone "ssh://v-alid.example.com/" --debug
1187 1209 running sh -c "read l; read l; read l" v-alid\.example\.com ['"]hg -R \. serve --stdio['"] (re)
1188 1210 sending upgrade request: * proto=exp-ssh-v2-0001 (glob) (sshv2 !)
1189 1211 sending hello command
1190 1212 sending between command
1191 1213 abort: no suitable response from remote hg!
1192 1214 [255]
1193 1215
1194 1216 We should not have created a file named owned - if it exists, the
1195 1217 attack succeeded.
1196 1218 $ if test -f owned; then echo 'you got owned'; fi
1197 1219
1198 1220 Cloning without fsmonitor enabled does not print a warning for small repos
1199 1221
1200 1222 $ hg clone a fsmonitor-default
1201 1223 updating to bookmark @ on branch stable
1202 1224 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1203 1225
1204 1226 Lower the warning threshold to simulate a large repo
1205 1227
1206 1228 $ cat >> $HGRCPATH << EOF
1207 1229 > [fsmonitor]
1208 1230 > warn_update_file_count = 2
1209 1231 > EOF
1210 1232
1211 1233 We should see a warning about no fsmonitor on supported platforms
1212 1234
1213 1235 #if linuxormacos no-fsmonitor
1214 1236 $ hg clone a nofsmonitor
1215 1237 updating to bookmark @ on branch stable
1216 1238 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1217 1239 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1218 1240 #else
1219 1241 $ hg clone a nofsmonitor
1220 1242 updating to bookmark @ on branch stable
1221 1243 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1222 1244 #endif
1223 1245
1224 1246 We should not see warning about fsmonitor when it is enabled
1225 1247
1226 1248 #if fsmonitor
1227 1249 $ hg clone a fsmonitor-enabled
1228 1250 updating to bookmark @ on branch stable
1229 1251 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1230 1252 #endif
1231 1253
1232 1254 We can disable the fsmonitor warning
1233 1255
1234 1256 $ hg --config fsmonitor.warn_when_unused=false clone a fsmonitor-disable-warning
1235 1257 updating to bookmark @ on branch stable
1236 1258 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1237 1259
1238 1260 Loaded fsmonitor but disabled in config should still print warning
1239 1261
1240 1262 #if linuxormacos fsmonitor
1241 1263 $ hg --config fsmonitor.mode=off clone a fsmonitor-mode-off
1242 1264 updating to bookmark @ on branch stable
1243 1265 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (fsmonitor !)
1244 1266 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
1245 1267 #endif
1246 1268
1247 1269 Warning not printed if working directory isn't empty
1248 1270
1249 1271 $ hg -q clone a fsmonitor-update
1250 1272 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor") (?)
1251 1273 $ cd fsmonitor-update
1252 1274 $ hg up acb14030fe0a
1253 1275 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
1254 1276 (leaving bookmark @)
1255 1277 $ hg up cf0fe1914066
1256 1278 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
1257 1279
1258 1280 `hg update` from null revision also prints
1259 1281
1260 1282 $ hg up null
1261 1283 0 files updated, 0 files merged, 2 files removed, 0 files unresolved
1262 1284
1263 1285 #if linuxormacos no-fsmonitor
1264 1286 $ hg up cf0fe1914066
1265 1287 (warning: large working directory being used without fsmonitor enabled; enable fsmonitor to improve performance; see "hg help -e fsmonitor")
1266 1288 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1267 1289 #else
1268 1290 $ hg up cf0fe1914066
1269 1291 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
1270 1292 #endif
1271 1293
1272 1294 $ cd ..
1273 1295
@@ -1,202 +1,207 b''
1 1 $ cat >> $HGRCPATH <<EOF
2 2 > [extensions]
3 3 > convert=
4 4 > [convert]
5 5 > hg.saverev=False
6 6 > EOF
7 7 $ hg init orig
8 8 $ cd orig
9 9 $ echo foo > foo
10 10 $ echo bar > bar
11 11 $ hg ci -qAm 'add foo bar' -d '0 0'
12 12 $ echo >> foo
13 13 $ hg ci -m 'change foo' -d '1 0'
14 14 $ hg up -qC 0
15 15 $ hg copy --after --force foo bar
16 16 $ hg copy foo baz
17 17 $ hg ci -m 'make bar and baz copies of foo' -d '2 0'
18 18 created new head
19 19
20 20 Test that template can print all file copies (issue4362)
21 21 $ hg log -r . --template "{file_copies % ' File: {file_copy}\n'}"
22 22 File: bar (foo)
23 23 File: baz (foo)
24 24
25 25 $ hg bookmark premerge1
26 26 $ hg merge -r 1
27 27 merging baz and foo to baz
28 28 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
29 29 (branch merge, don't forget to commit)
30 30 $ hg ci -m 'merge local copy' -d '3 0'
31 31 $ hg up -C 1
32 32 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
33 33 (leaving bookmark premerge1)
34 34 $ hg bookmark premerge2
35 35 $ hg merge 2
36 36 merging foo and baz to baz
37 37 1 files updated, 1 files merged, 0 files removed, 0 files unresolved
38 38 (branch merge, don't forget to commit)
39 39 $ hg ci -m 'merge remote copy' -d '4 0'
40 40 created new head
41 41
42 42 Make and delete some tags
43 43
44 44 $ hg tag that
45 45 $ hg tag --remove that
46 46 $ hg tag this
47 47
48 48 #if execbit
49 49 $ chmod +x baz
50 50 #else
51 51 $ echo some other change to make sure we get a rev 5 > baz
52 52 #endif
53 53 $ hg ci -m 'mark baz executable' -d '5 0'
54 54 $ cd ..
55 55 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
56 56 initializing destination new repository
57 57 scanning source...
58 58 sorting...
59 59 converting...
60 60 8 add foo bar
61 61 7 change foo
62 62 6 make bar and baz copies of foo
63 63 5 merge local copy
64 64 4 merge remote copy
65 65 3 Added tag that for changeset 88586c4e9f02
66 66 2 Removed tag that
67 67 1 Added tag this for changeset c56a7f387039
68 68 0 mark baz executable
69 69 updating bookmarks
70 70 $ cd new
71 71 $ hg out ../orig
72 72 comparing with ../orig
73 73 searching for changes
74 74 no changes found
75 75 [1]
76 76 #if execbit
77 77 $ hg bookmarks
78 78 premerge1 3:973ef48a98a4
79 79 premerge2 8:91d107c423ba
80 80 #else
81 81 Different hash because no x bit
82 82 $ hg bookmarks
83 83 premerge1 3:973ef48a98a4
84 84 premerge2 8:3537b15eaaca
85 85 #endif
86 86
87 87 Test that redoing a convert results in an identical graph
88 88 $ cd ../
89 89 $ rm new/.hg/shamap
90 90 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
91 91 scanning source...
92 92 sorting...
93 93 converting...
94 94 8 add foo bar
95 95 7 change foo
96 96 6 make bar and baz copies of foo
97 97 5 merge local copy
98 98 4 merge remote copy
99 99 3 Added tag that for changeset 88586c4e9f02
100 100 2 Removed tag that
101 101 1 Added tag this for changeset c56a7f387039
102 102 0 mark baz executable
103 103 updating bookmarks
104 104 $ hg -R new log -G -T '{rev} {desc}'
105 105 o 8 mark baz executable
106 106 |
107 107 o 7 Added tag this for changeset c56a7f387039
108 108 |
109 109 o 6 Removed tag that
110 110 |
111 111 o 5 Added tag that for changeset 88586c4e9f02
112 112 |
113 113 o 4 merge remote copy
114 114 |\
115 115 +---o 3 merge local copy
116 116 | |/
117 117 | o 2 make bar and baz copies of foo
118 118 | |
119 119 o | 1 change foo
120 120 |/
121 121 o 0 add foo bar
122 122
123 123
124 124 check shamap LF and CRLF handling
125 125
126 126 $ cat > rewrite.py <<EOF
127 127 > import sys
128 128 > # Interlace LF and CRLF
129 129 > lines = [(l.rstrip() + ((i % 2) and b'\n' or b'\r\n'))
130 130 > for i, l in enumerate(open(sys.argv[1], 'rb'))]
131 131 > open(sys.argv[1], 'wb').write(b''.join(lines))
132 132 > EOF
133 133 $ $PYTHON rewrite.py new/.hg/shamap
134 134 $ cd orig
135 135 $ hg up -qC 1
136 136 $ echo foo >> foo
137 137 $ hg ci -qm 'change foo again'
138 138 $ hg up -qC 2
139 139 $ echo foo >> foo
140 140 $ hg ci -qm 'change foo again again'
141 141 $ cd ..
142 142 $ hg convert --datesort orig new 2>&1 | grep -v 'subversion python bindings could not be loaded'
143 143 scanning source...
144 144 sorting...
145 145 converting...
146 146 1 change foo again again
147 147 0 change foo again
148 148 updating bookmarks
149 149
150 150 init broken repository
151 151
152 152 $ hg init broken
153 153 $ cd broken
154 154 $ echo a >> a
155 155 $ echo b >> b
156 156 $ hg ci -qAm init
157 157 $ echo a >> a
158 158 $ echo b >> b
159 159 $ hg copy b c
160 160 $ hg ci -qAm changeall
161 161 $ hg up -qC 0
162 162 $ echo bc >> b
163 163 $ hg ci -m changebagain
164 164 created new head
165 165 $ HGMERGE=internal:local hg -q merge
166 166 $ hg ci -m merge
167 167 $ hg mv b d
168 168 $ hg ci -m moveb
169 169
170 170 break it
171 171
172 #if reporevlogstore
172 173 $ rm .hg/store/data/b.*
174 #endif
175 #if reposimplestore
176 $ rm .hg/store/data/b/*
177 #endif
173 178 $ cd ..
174 179 $ hg --config convert.hg.ignoreerrors=True convert broken fixed
175 180 initializing destination fixed repository
176 181 scanning source...
177 182 sorting...
178 183 converting...
179 184 4 init
180 185 ignoring: data/b.i@1e88685f5dde: no match found
181 186 3 changeall
182 187 2 changebagain
183 188 1 merge
184 189 0 moveb
185 190 $ hg -R fixed verify
186 191 checking changesets
187 192 checking manifests
188 193 crosschecking files in changesets and manifests
189 194 checking files
190 195 3 files, 5 changesets, 5 total revisions
191 196
192 197 manifest -r 0
193 198
194 199 $ hg -R fixed manifest -r 0
195 200 a
196 201
197 202 manifest -r tip
198 203
199 204 $ hg -R fixed manifest -r tip
200 205 a
201 206 c
202 207 d
@@ -1,374 +1,392 b''
1 1 #testcases flat tree
2 2
3 3 $ . "$TESTDIR/narrow-library.sh"
4 4
5 5 #if tree
6 6 $ cat << EOF >> $HGRCPATH
7 7 > [experimental]
8 8 > treemanifest = 1
9 9 > EOF
10 10 #endif
11 11
12 12 $ hg init master
13 13 $ cd master
14 14 $ cat >> .hg/hgrc <<EOF
15 15 > [narrow]
16 16 > serveellipses=True
17 17 > EOF
18 18 $ for x in `$TESTDIR/seq.py 0 10`
19 19 > do
20 20 > mkdir d$x
21 21 > echo $x > d$x/f
22 22 > hg add d$x/f
23 23 > hg commit -m "add d$x/f"
24 24 > done
25 25 $ hg log -T "{node|short}: {desc}\n"
26 26 *: add d10/f (glob)
27 27 *: add d9/f (glob)
28 28 *: add d8/f (glob)
29 29 *: add d7/f (glob)
30 30 *: add d6/f (glob)
31 31 *: add d5/f (glob)
32 32 *: add d4/f (glob)
33 33 *: add d3/f (glob)
34 34 *: add d2/f (glob)
35 35 *: add d1/f (glob)
36 36 *: add d0/f (glob)
37 37 $ cd ..
38 38
39 39 Error if '.' or '..' are in the directory to track.
40 40 $ hg clone --narrow ssh://user@dummy/master foo --include ./asdf
41 41 requesting all changes
42 42 abort: "." and ".." are not allowed in narrowspec paths
43 43 [255]
44 44 $ hg clone --narrow ssh://user@dummy/master foo --include asdf/..
45 45 requesting all changes
46 46 abort: "." and ".." are not allowed in narrowspec paths
47 47 [255]
48 48 $ hg clone --narrow ssh://user@dummy/master foo --include a/./c
49 49 requesting all changes
50 50 abort: "." and ".." are not allowed in narrowspec paths
51 51 [255]
52 52
53 53 Names with '.' in them are OK.
54 54 $ hg clone --narrow ssh://user@dummy/master should-work --include a/.b/c
55 55 requesting all changes
56 56 adding changesets
57 57 adding manifests
58 58 adding file changes
59 59 added 1 changesets with 0 changes to 0 files
60 60 new changesets * (glob)
61 61 updating to branch default
62 62 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
63 63
64 64 Test repo with local changes
65 65 $ hg clone --narrow ssh://user@dummy/master narrow-local-changes --include d0 --include d3 --include d6
66 66 requesting all changes
67 67 adding changesets
68 68 adding manifests
69 69 adding file changes
70 70 added 6 changesets with 3 changes to 3 files
71 71 new changesets *:* (glob)
72 72 updating to branch default
73 73 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
74 74 $ cd narrow-local-changes
75 75 $ cat >> $HGRCPATH << EOF
76 76 > [experimental]
77 77 > evolution=createmarkers
78 78 > EOF
79 79 $ echo local change >> d0/f
80 80 $ hg ci -m 'local change to d0'
81 81 $ hg co '.^'
82 82 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
83 83 $ echo local change >> d3/f
84 84 $ hg ci -m 'local hidden change to d3'
85 85 created new head
86 86 $ hg ci --amend -m 'local change to d3'
87 87 $ hg tracked --removeinclude d0
88 88 comparing with ssh://user@dummy/master
89 89 searching for changes
90 90 looking for local changes to affected paths
91 91 The following changeset(s) or their ancestors have local changes not on the remote:
92 92 * (glob)
93 93 abort: local changes found
94 94 (use --force-delete-local-changes to ignore)
95 95 [255]
96 96 Check that nothing was removed by the failed attempts
97 97 $ hg tracked
98 98 I path:d0
99 99 I path:d3
100 100 I path:d6
101 101 $ hg files
102 102 d0/f
103 103 d3/f
104 104 d6/f
105 105 $ find *
106 106 d0
107 107 d0/f
108 108 d3
109 109 d3/f
110 110 d6
111 111 d6/f
112 112 $ hg verify -q
113 113 Force deletion of local changes
114 114 $ hg log -T "{node|short}: {desc} {outsidenarrow}\n"
115 115 *: local change to d3 (glob)
116 116 *: local change to d0 (glob)
117 117 *: add d10/f outsidenarrow (glob)
118 118 *: add d6/f (glob)
119 119 *: add d5/f outsidenarrow (glob)
120 120 *: add d3/f (glob)
121 121 *: add d2/f outsidenarrow (glob)
122 122 *: add d0/f (glob)
123 123 $ hg tracked --removeinclude d0 --force-delete-local-changes
124 124 comparing with ssh://user@dummy/master
125 125 searching for changes
126 126 looking for local changes to affected paths
127 127 The following changeset(s) or their ancestors have local changes not on the remote:
128 128 * (glob)
129 129 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
130 deleting data/d0/f.i
130 deleting data/d0/f.i (reporevlogstore !)
131 deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !)
132 deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !)
133 deleting data/d0/f/index (reposimplestore !)
131 134 deleting meta/d0/00manifest.i (tree !)
135
132 136 $ hg log -T "{node|short}: {desc} {outsidenarrow}\n"
133 137 *: local change to d3 (glob)
134 138 *: add d10/f outsidenarrow (glob)
135 139 *: add d6/f (glob)
136 140 *: add d5/f outsidenarrow (glob)
137 141 *: add d3/f (glob)
138 142 *: add d2/f outsidenarrow (glob)
139 143 *: add d0/f outsidenarrow (glob)
140 144 Can restore stripped local changes after widening
141 145 $ hg tracked --addinclude d0 -q
142 146 $ hg unbundle .hg/strip-backup/*-narrow.hg -q
143 147 $ hg --hidden co -r 'desc("local change to d0")' -q
144 148 $ cat d0/f
145 149 0
146 150 local change
147 151 Pruned commits affecting removed paths should not prevent narrowing
148 152 $ hg co '.^'
149 153 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 154 $ hg debugobsolete `hg log -T '{node}' -r 'desc("local change to d0")'`
151 155 obsoleted 1 changesets
152 156 $ hg tracked --removeinclude d0
153 157 comparing with ssh://user@dummy/master
154 158 searching for changes
155 159 looking for local changes to affected paths
156 160 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
157 deleting data/d0/f.i
161 deleting data/d0/f.i (reporevlogstore !)
162 deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !)
163 deleting data/d0/f/4374b5650fc5ae54ac857c0f0381971fdde376f7 (reposimplestore !)
164 deleting data/d0/f/index (reposimplestore !)
158 165 deleting meta/d0/00manifest.i (tree !)
166
159 167 Updates off of stripped commit if necessary
160 168 $ hg co -r 'desc("local change to d3")' -q
161 169 $ echo local change >> d6/f
162 170 $ hg ci -m 'local change to d6'
163 171 $ hg tracked --removeinclude d3 --force-delete-local-changes
164 172 comparing with ssh://user@dummy/master
165 173 searching for changes
166 174 looking for local changes to affected paths
167 175 The following changeset(s) or their ancestors have local changes not on the remote:
168 176 * (glob)
169 177 * (glob)
170 178 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
171 179 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
172 deleting data/d3/f.i
180 deleting data/d3/f.i (reporevlogstore !)
181 deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !)
182 deleting data/d3/f/99fa7136105a15e2045ce3d9152e4837c5349e4d (reposimplestore !)
183 deleting data/d3/f/index (reposimplestore !)
173 184 deleting meta/d3/00manifest.i (tree !)
174 185 $ hg log -T '{desc}\n' -r .
175 186 add d10/f
176 187 Updates to nullid if necessary
177 188 $ hg tracked --addinclude d3 -q
178 189 $ hg co null -q
179 190 $ mkdir d3
180 191 $ echo local change > d3/f
181 192 $ hg add d3/f
182 193 $ hg ci -m 'local change to d3'
183 194 created new head
184 195 $ hg tracked --removeinclude d3 --force-delete-local-changes
185 196 comparing with ssh://user@dummy/master
186 197 searching for changes
187 198 looking for local changes to affected paths
188 199 The following changeset(s) or their ancestors have local changes not on the remote:
189 200 * (glob)
190 201 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
191 202 saved backup bundle to $TESTTMP/narrow-local-changes/.hg/strip-backup/*-narrow.hg (glob)
192 deleting data/d3/f.i
203 deleting data/d3/f.i (reporevlogstore !)
204 deleting data/d3/f/2661d26c649684b482d10f91960cc3db683c38b4 (reposimplestore !)
205 deleting data/d3/f/5ce0767945cbdbca3b924bb9fbf5143f72ab40ac (reposimplestore !)
206 deleting data/d3/f/index (reposimplestore !)
193 207 deleting meta/d3/00manifest.i (tree !)
194 208 $ hg id
195 209 000000000000
196 210 $ cd ..
197 211
198 212 Can remove last include, making repo empty
199 213 $ hg clone --narrow ssh://user@dummy/master narrow-empty --include d0 -r 5
200 214 adding changesets
201 215 adding manifests
202 216 adding file changes
203 217 added 2 changesets with 1 changes to 1 files
204 218 new changesets *:* (glob)
205 219 updating to branch default
206 220 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
207 221 $ cd narrow-empty
208 222 $ hg tracked --removeinclude d0
209 223 comparing with ssh://user@dummy/master
210 224 searching for changes
211 225 looking for local changes to affected paths
212 deleting data/d0/f.i
226 deleting data/d0/f.i (reporevlogstore !)
227 deleting data/d0/f/362fef284ce2ca02aecc8de6d5e8a1c3af0556fe (reposimplestore !)
228 deleting data/d0/f/index (reposimplestore !)
213 229 deleting meta/d0/00manifest.i (tree !)
214 230 $ hg tracked
215 231 $ hg files
216 232 [1]
217 233 $ test -d d0
218 234 [1]
219 235 Do some work in the empty clone
220 236 $ hg diff --change .
221 237 $ hg branch foo
222 238 marked working directory as branch foo
223 239 (branches are permanent and global, did you want a bookmark?)
224 240 $ hg ci -m empty
225 241 $ hg pull -q
226 242 Can widen the empty clone
227 243 $ hg tracked --addinclude d0
228 244 comparing with ssh://user@dummy/master
229 245 searching for changes
230 246 no changes found
231 247 saved backup bundle to $TESTTMP/narrow-empty/.hg/strip-backup/*-widen.hg (glob)
232 248 adding changesets
233 249 adding manifests
234 250 adding file changes
235 251 added 3 changesets with 1 changes to 1 files
236 252 new changesets *:* (glob)
237 253 $ hg tracked
238 254 I path:d0
239 255 $ hg files
240 256 d0/f
241 257 $ find *
242 258 d0
243 259 d0/f
244 260 $ cd ..
245 261
246 262 TODO(martinvonz): test including e.g. d3/g and then removing it once
247 263 https://bitbucket.org/Google/narrowhg/issues/6 is fixed
248 264
249 265 $ hg clone --narrow ssh://user@dummy/master narrow --include d0 --include d3 --include d6 --include d9
250 266 requesting all changes
251 267 adding changesets
252 268 adding manifests
253 269 adding file changes
254 270 added 8 changesets with 4 changes to 4 files
255 271 new changesets *:* (glob)
256 272 updating to branch default
257 273 4 files updated, 0 files merged, 0 files removed, 0 files unresolved
258 274 $ cd narrow
259 275 $ hg tracked
260 276 I path:d0
261 277 I path:d3
262 278 I path:d6
263 279 I path:d9
264 280 $ hg tracked --removeinclude d6
265 281 comparing with ssh://user@dummy/master
266 282 searching for changes
267 283 looking for local changes to affected paths
268 deleting data/d6/f.i
284 deleting data/d6/f.i (reporevlogstore !)
285 deleting data/d6/f/7339d30678f451ac8c3f38753beeb4cf2e1655c7 (reposimplestore !)
286 deleting data/d6/f/index (reposimplestore !)
269 287 deleting meta/d6/00manifest.i (tree !)
270 288 $ hg tracked
271 289 I path:d0
272 290 I path:d3
273 291 I path:d9
274 292 $ hg debugrebuildfncache
275 293 fncache already up to date
276 294 $ find *
277 295 d0
278 296 d0/f
279 297 d3
280 298 d3/f
281 299 d9
282 300 d9/f
283 301 $ hg verify -q
284 302 $ hg tracked --addexclude d3/f
285 303 comparing with ssh://user@dummy/master
286 304 searching for changes
287 305 looking for local changes to affected paths
288 deleting data/d3/f.i
306 deleting data/d3/f.i (reporevlogstore !)
289 307 $ hg tracked
290 308 I path:d0
291 309 I path:d3
292 310 I path:d9
293 311 X path:d3/f
294 312 $ hg debugrebuildfncache
295 313 fncache already up to date
296 314 $ find *
297 315 d0
298 316 d0/f
299 317 d9
300 318 d9/f
301 319 $ hg verify -q
302 320 $ hg tracked --addexclude d0
303 321 comparing with ssh://user@dummy/master
304 322 searching for changes
305 323 looking for local changes to affected paths
306 deleting data/d0/f.i
324 deleting data/d0/f.i (reporevlogstore !)
307 325 deleting meta/d0/00manifest.i (tree !)
308 326 $ hg tracked
309 327 I path:d3
310 328 I path:d9
311 329 X path:d0
312 330 X path:d3/f
313 331 $ hg debugrebuildfncache
314 332 fncache already up to date
315 333 $ find *
316 334 d9
317 335 d9/f
318 336
319 337 Make a 15 of changes to d9 to test the path without --verbose
320 338 (Note: using regexes instead of "* (glob)" because if the test fails, it
321 339 produces more sensible diffs)
322 340 $ hg tracked
323 341 I path:d3
324 342 I path:d9
325 343 X path:d0
326 344 X path:d3/f
327 345 $ for x in `$TESTDIR/seq.py 1 15`
328 346 > do
329 347 > echo local change >> d9/f
330 348 > hg commit -m "change $x to d9/f"
331 349 > done
332 350 $ hg tracked --removeinclude d9
333 351 comparing with ssh://user@dummy/master
334 352 searching for changes
335 353 looking for local changes to affected paths
336 354 The following changeset(s) or their ancestors have local changes not on the remote:
337 355 ^[0-9a-f]{12}$ (re)
338 356 ^[0-9a-f]{12}$ (re)
339 357 ^[0-9a-f]{12}$ (re)
340 358 ^[0-9a-f]{12}$ (re)
341 359 ^[0-9a-f]{12}$ (re)
342 360 ^[0-9a-f]{12}$ (re)
343 361 ^[0-9a-f]{12}$ (re)
344 362 ^[0-9a-f]{12}$ (re)
345 363 ^[0-9a-f]{12}$ (re)
346 364 ^[0-9a-f]{12}$ (re)
347 365 ...and 5 more, use --verbose to list all
348 366 abort: local changes found
349 367 (use --force-delete-local-changes to ignore)
350 368 [255]
351 369 Now test it *with* verbose.
352 370 $ hg tracked --removeinclude d9 --verbose
353 371 comparing with ssh://user@dummy/master
354 372 searching for changes
355 373 looking for local changes to affected paths
356 374 The following changeset(s) or their ancestors have local changes not on the remote:
357 375 ^[0-9a-f]{12}$ (re)
358 376 ^[0-9a-f]{12}$ (re)
359 377 ^[0-9a-f]{12}$ (re)
360 378 ^[0-9a-f]{12}$ (re)
361 379 ^[0-9a-f]{12}$ (re)
362 380 ^[0-9a-f]{12}$ (re)
363 381 ^[0-9a-f]{12}$ (re)
364 382 ^[0-9a-f]{12}$ (re)
365 383 ^[0-9a-f]{12}$ (re)
366 384 ^[0-9a-f]{12}$ (re)
367 385 ^[0-9a-f]{12}$ (re)
368 386 ^[0-9a-f]{12}$ (re)
369 387 ^[0-9a-f]{12}$ (re)
370 388 ^[0-9a-f]{12}$ (re)
371 389 ^[0-9a-f]{12}$ (re)
372 390 abort: local changes found
373 391 (use --force-delete-local-changes to ignore)
374 392 [255]
General Comments 0
You need to be logged in to leave comments. Login now