comparison tests/test-treemanifest.t @ 31262:1871a1ee64ed

treemanifest: add tests covering hg diff of partial trees Previously the hg files tests also covered the logic (i.e. treemanifest.matches) that governed how hg diff limited its diff. In a future patch we will be switching treemanifest.diff() to have a custom implementation, so let's go ahead and add equivalent test coverage for hg diff.
author Durham Goode <durham@fb.com>
date Tue, 07 Mar 2017 18:29:58 -0800
parents c059286a0f9c
children c134a33b1d73
comparison
equal deleted inserted replaced
31261:bd884ef2ee46 31262:1871a1ee64ed
435 $ touch c.txt 435 $ touch c.txt
436 $ touch d.py 436 $ touch d.py
437 437
438 $ hg ci -Aqm 'initial' 438 $ hg ci -Aqm 'initial'
439 439
440 $ echo >> .A/one.txt
441 $ echo >> .A/two.txt
442 $ echo >> b/bar/fruits.txt
443 $ echo >> b/bar/orange/fly/gnat.py
444 $ echo >> b/bar/orange/fly/housefly.txt
445 $ echo >> b/foo/apple/bees/flower.py
446 $ echo >> c.txt
447 $ echo >> d.py
448 $ hg ci -Aqm 'second'
449
440 We'll see that visitdir works by removing some treemanifest revlogs and running 450 We'll see that visitdir works by removing some treemanifest revlogs and running
441 the files command with various parameters. 451 the files command with various parameters.
442 452
443 Test files from the root. 453 Test files from the root.
444 454
466 $ hg files -r . b 476 $ hg files -r . b
467 b/bar/fruits.txt (glob) 477 b/bar/fruits.txt (glob)
468 b/bar/orange/fly/gnat.py (glob) 478 b/bar/orange/fly/gnat.py (glob)
469 b/bar/orange/fly/housefly.txt (glob) 479 b/bar/orange/fly/housefly.txt (glob)
470 b/foo/apple/bees/flower.py (glob) 480 b/foo/apple/bees/flower.py (glob)
481 $ hg diff -r '.^' -r . --stat b
482 b/bar/fruits.txt | 1 +
483 b/bar/orange/fly/gnat.py | 1 +
484 b/bar/orange/fly/housefly.txt | 1 +
485 b/foo/apple/bees/flower.py | 1 +
486 4 files changed, 4 insertions(+), 0 deletions(-)
471 $ cp -R .hg/store-copy/. .hg/store 487 $ cp -R .hg/store-copy/. .hg/store
472 488
473 Test files with just includes and excludes. 489 Test files with just includes and excludes.
474 490
475 $ rm -r .hg/store/meta/~2e_a 491 $ rm -r .hg/store/meta/~2e_a
476 $ rm -r .hg/store/meta/b/bar/orange/fly 492 $ rm -r .hg/store/meta/b/bar/orange/fly
477 $ rm -r .hg/store/meta/b/foo/apple/bees 493 $ rm -r .hg/store/meta/b/foo/apple/bees
478 $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees 494 $ hg files -r . -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
479 b/bar/fruits.txt (glob) 495 b/bar/fruits.txt (glob)
496 $ hg diff -r '.^' -r . --stat -I path:b/bar -X path:b/bar/orange/fly -I path:b/foo -X path:b/foo/apple/bees
497 b/bar/fruits.txt | 1 +
498 1 files changed, 1 insertions(+), 0 deletions(-)
480 $ cp -R .hg/store-copy/. .hg/store 499 $ cp -R .hg/store-copy/. .hg/store
481 500
482 Test files for a subdirectory, excluding a directory within it. 501 Test files for a subdirectory, excluding a directory within it.
483 502
484 $ rm -r .hg/store/meta/~2e_a 503 $ rm -r .hg/store/meta/~2e_a
485 $ rm -r .hg/store/meta/b/foo 504 $ rm -r .hg/store/meta/b/foo
486 $ hg files -r . -X path:b/foo b 505 $ hg files -r . -X path:b/foo b
487 b/bar/fruits.txt (glob) 506 b/bar/fruits.txt (glob)
488 b/bar/orange/fly/gnat.py (glob) 507 b/bar/orange/fly/gnat.py (glob)
489 b/bar/orange/fly/housefly.txt (glob) 508 b/bar/orange/fly/housefly.txt (glob)
509 $ hg diff -r '.^' -r . --stat -X path:b/foo b
510 b/bar/fruits.txt | 1 +
511 b/bar/orange/fly/gnat.py | 1 +
512 b/bar/orange/fly/housefly.txt | 1 +
513 3 files changed, 3 insertions(+), 0 deletions(-)
490 $ cp -R .hg/store-copy/. .hg/store 514 $ cp -R .hg/store-copy/. .hg/store
491 515
492 Test files for a sub directory, including only a directory within it, and 516 Test files for a sub directory, including only a directory within it, and
493 including an unrelated directory. 517 including an unrelated directory.
494 518
495 $ rm -r .hg/store/meta/~2e_a 519 $ rm -r .hg/store/meta/~2e_a
496 $ rm -r .hg/store/meta/b/foo 520 $ rm -r .hg/store/meta/b/foo
497 $ hg files -r . -I path:b/bar/orange -I path:a b 521 $ hg files -r . -I path:b/bar/orange -I path:a b
498 b/bar/orange/fly/gnat.py (glob) 522 b/bar/orange/fly/gnat.py (glob)
499 b/bar/orange/fly/housefly.txt (glob) 523 b/bar/orange/fly/housefly.txt (glob)
524 $ hg diff -r '.^' -r . --stat -I path:b/bar/orange -I path:a b
525 b/bar/orange/fly/gnat.py | 1 +
526 b/bar/orange/fly/housefly.txt | 1 +
527 2 files changed, 2 insertions(+), 0 deletions(-)
500 $ cp -R .hg/store-copy/. .hg/store 528 $ cp -R .hg/store-copy/. .hg/store
501 529
502 Test files for a pattern, including a directory, and excluding a directory 530 Test files for a pattern, including a directory, and excluding a directory
503 within that. 531 within that.
504 532
505 $ rm -r .hg/store/meta/~2e_a 533 $ rm -r .hg/store/meta/~2e_a
506 $ rm -r .hg/store/meta/b/foo 534 $ rm -r .hg/store/meta/b/foo
507 $ rm -r .hg/store/meta/b/bar/orange 535 $ rm -r .hg/store/meta/b/bar/orange
508 $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange 536 $ hg files -r . glob:**.txt -I path:b/bar -X path:b/bar/orange
509 b/bar/fruits.txt (glob) 537 b/bar/fruits.txt (glob)
538 $ hg diff -r '.^' -r . --stat glob:**.txt -I path:b/bar -X path:b/bar/orange
539 b/bar/fruits.txt | 1 +
540 1 files changed, 1 insertions(+), 0 deletions(-)
510 $ cp -R .hg/store-copy/. .hg/store 541 $ cp -R .hg/store-copy/. .hg/store
511 542
512 Add some more changes to the deep repo 543 Add some more changes to the deep repo
513 $ echo narf >> b/bar/fruits.txt 544 $ echo narf >> b/bar/fruits.txt
514 $ hg ci -m narf 545 $ hg ci -m narf
520 checking changesets 551 checking changesets
521 checking manifests 552 checking manifests
522 checking directory manifests 553 checking directory manifests
523 crosschecking files in changesets and manifests 554 crosschecking files in changesets and manifests
524 checking files 555 checking files
525 8 files, 3 changesets, 10 total revisions 556 8 files, 4 changesets, 18 total revisions
526 557
527 Dirlogs are included in fncache 558 Dirlogs are included in fncache
528 $ grep meta/.A/00manifest.i .hg/store/fncache 559 $ grep meta/.A/00manifest.i .hg/store/fncache
529 meta/.A/00manifest.i 560 meta/.A/00manifest.i
530 561
561 checking changesets 592 checking changesets
562 checking manifests 593 checking manifests
563 checking directory manifests 594 checking directory manifests
564 0: empty or missing b/ 595 0: empty or missing b/
565 b/@0: parent-directory manifest refers to unknown revision 67688a370455 596 b/@0: parent-directory manifest refers to unknown revision 67688a370455
566 b/@1: parent-directory manifest refers to unknown revision f38e85d334c5 597 b/@1: parent-directory manifest refers to unknown revision f065da70369e
567 b/@2: parent-directory manifest refers to unknown revision 99c9792fd4b0 598 b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
599 b/@3: parent-directory manifest refers to unknown revision 367152e6af28
568 warning: orphan revlog 'meta/b/bar/00manifest.i' 600 warning: orphan revlog 'meta/b/bar/00manifest.i'
569 warning: orphan revlog 'meta/b/bar/orange/00manifest.i' 601 warning: orphan revlog 'meta/b/bar/orange/00manifest.i'
570 warning: orphan revlog 'meta/b/bar/orange/fly/00manifest.i' 602 warning: orphan revlog 'meta/b/bar/orange/fly/00manifest.i'
571 warning: orphan revlog 'meta/b/foo/00manifest.i' 603 warning: orphan revlog 'meta/b/foo/00manifest.i'
572 warning: orphan revlog 'meta/b/foo/apple/00manifest.i' 604 warning: orphan revlog 'meta/b/foo/apple/00manifest.i'
575 b/bar/fruits.txt@0: in changeset but not in manifest 607 b/bar/fruits.txt@0: in changeset but not in manifest
576 b/bar/orange/fly/gnat.py@0: in changeset but not in manifest 608 b/bar/orange/fly/gnat.py@0: in changeset but not in manifest
577 b/bar/orange/fly/housefly.txt@0: in changeset but not in manifest 609 b/bar/orange/fly/housefly.txt@0: in changeset but not in manifest
578 b/foo/apple/bees/flower.py@0: in changeset but not in manifest 610 b/foo/apple/bees/flower.py@0: in changeset but not in manifest
579 checking files 611 checking files
580 8 files, 3 changesets, 10 total revisions 612 8 files, 4 changesets, 18 total revisions
581 6 warnings encountered! 613 6 warnings encountered!
582 8 integrity errors encountered! 614 9 integrity errors encountered!
583 (first damaged changeset appears to be 0) 615 (first damaged changeset appears to be 0)
584 [1] 616 [1]
585 $ cp -R .hg/store-newcopy/. .hg/store 617 $ cp -R .hg/store-newcopy/. .hg/store
586 618
587 Verify reports missing dirlog entry 619 Verify reports missing dirlog entry
588 $ mv -f .hg/store-copy/meta/b/00manifest.* .hg/store/meta/b/ 620 $ mv -f .hg/store-copy/meta/b/00manifest.* .hg/store/meta/b/
589 $ hg verify 621 $ hg verify
590 checking changesets 622 checking changesets
591 checking manifests 623 checking manifests
592 checking directory manifests 624 checking directory manifests
593 b/@1: parent-directory manifest refers to unknown revision f38e85d334c5 625 b/@2: parent-directory manifest refers to unknown revision ac0d30948e0b
594 b/@2: parent-directory manifest refers to unknown revision 99c9792fd4b0 626 b/@3: parent-directory manifest refers to unknown revision 367152e6af28
595 b/bar/@?: rev 1 points to unexpected changeset 1
596 b/bar/@?: 5e03c4ee5e4a not in parent-directory manifest
597 b/bar/@?: rev 2 points to unexpected changeset 2 627 b/bar/@?: rev 2 points to unexpected changeset 2
598 b/bar/@?: 1b16940d66d6 not in parent-directory manifest 628 b/bar/@?: 44d7e1146e0d not in parent-directory manifest
599 b/bar/orange/@?: rev 1 points to unexpected changeset 2 629 b/bar/@?: rev 3 points to unexpected changeset 3
630 b/bar/@?: 70b10c6b17b7 not in parent-directory manifest
631 b/bar/orange/@?: rev 2 points to unexpected changeset 3
600 (expected None) 632 (expected None)
601 b/bar/orange/fly/@?: rev 1 points to unexpected changeset 2 633 b/bar/orange/fly/@?: rev 2 points to unexpected changeset 3
602 (expected None) 634 (expected None)
603 crosschecking files in changesets and manifests 635 crosschecking files in changesets and manifests
604 checking files 636 checking files
605 8 files, 3 changesets, 10 total revisions 637 8 files, 4 changesets, 18 total revisions
606 2 warnings encountered! 638 2 warnings encountered!
607 8 integrity errors encountered! 639 8 integrity errors encountered!
608 (first damaged changeset appears to be 1) 640 (first damaged changeset appears to be 2)
609 [1] 641 [1]
610 $ cp -R .hg/store-newcopy/. .hg/store 642 $ cp -R .hg/store-newcopy/. .hg/store
611 643
612 Test cloning a treemanifest repo over http. 644 Test cloning a treemanifest repo over http.
613 $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log 645 $ hg serve -p $HGPORT -d --pid-file=hg.pid --errorlog=errors.log
619 > http://localhost:$HGPORT deepclone 651 > http://localhost:$HGPORT deepclone
620 requesting all changes 652 requesting all changes
621 adding changesets 653 adding changesets
622 adding manifests 654 adding manifests
623 adding file changes 655 adding file changes
624 added 3 changesets with 10 changes to 8 files 656 added 4 changesets with 18 changes to 8 files
625 updating to branch default 657 updating to branch default
626 8 files updated, 0 files merged, 0 files removed, 0 files unresolved 658 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
627 No server errors. 659 No server errors.
628 $ cat deeprepo/errors.log 660 $ cat deeprepo/errors.log
629 requires got updated to include treemanifest 661 requires got updated to include treemanifest
654 checking changesets 686 checking changesets
655 checking manifests 687 checking manifests
656 checking directory manifests 688 checking directory manifests
657 crosschecking files in changesets and manifests 689 crosschecking files in changesets and manifests
658 checking files 690 checking files
659 8 files, 3 changesets, 10 total revisions 691 8 files, 4 changesets, 18 total revisions
660 $ cd .. 692 $ cd ..
661 693
662 Create clones using old repo formats to use in later tests 694 Create clones using old repo formats to use in later tests
663 $ hg clone --config format.usestore=False \ 695 $ hg clone --config format.usestore=False \
664 > --config experimental.changegroup3=True \ 696 > --config experimental.changegroup3=True \
665 > http://localhost:$HGPORT deeprepo-basicstore 697 > http://localhost:$HGPORT deeprepo-basicstore
666 requesting all changes 698 requesting all changes
667 adding changesets 699 adding changesets
668 adding manifests 700 adding manifests
669 adding file changes 701 adding file changes
670 added 3 changesets with 10 changes to 8 files 702 added 4 changesets with 18 changes to 8 files
671 updating to branch default 703 updating to branch default
672 8 files updated, 0 files merged, 0 files removed, 0 files unresolved 704 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
673 $ cd deeprepo-basicstore 705 $ cd deeprepo-basicstore
674 $ grep store .hg/requires 706 $ grep store .hg/requires
675 [1] 707 [1]
681 > http://localhost:$HGPORT deeprepo-encodedstore 713 > http://localhost:$HGPORT deeprepo-encodedstore
682 requesting all changes 714 requesting all changes
683 adding changesets 715 adding changesets
684 adding manifests 716 adding manifests
685 adding file changes 717 adding file changes
686 added 3 changesets with 10 changes to 8 files 718 added 4 changesets with 18 changes to 8 files
687 updating to branch default 719 updating to branch default
688 8 files updated, 0 files merged, 0 files removed, 0 files unresolved 720 8 files updated, 0 files merged, 0 files removed, 0 files unresolved
689 $ cd deeprepo-encodedstore 721 $ cd deeprepo-encodedstore
690 $ grep fncache .hg/requires 722 $ grep fncache .hg/requires
691 [1] 723 [1]
699 checking changesets 731 checking changesets
700 checking manifests 732 checking manifests
701 checking directory manifests 733 checking directory manifests
702 crosschecking files in changesets and manifests 734 crosschecking files in changesets and manifests
703 checking files 735 checking files
704 8 files, 3 changesets, 10 total revisions 736 8 files, 4 changesets, 18 total revisions
705 737
706 Local clone with encodedstore 738 Local clone with encodedstore
707 $ hg clone -U deeprepo-encodedstore local-clone-encodedstore 739 $ hg clone -U deeprepo-encodedstore local-clone-encodedstore
708 $ hg -R local-clone-encodedstore verify 740 $ hg -R local-clone-encodedstore verify
709 checking changesets 741 checking changesets
710 checking manifests 742 checking manifests
711 checking directory manifests 743 checking directory manifests
712 crosschecking files in changesets and manifests 744 crosschecking files in changesets and manifests
713 checking files 745 checking files
714 8 files, 3 changesets, 10 total revisions 746 8 files, 4 changesets, 18 total revisions
715 747
716 Local clone with fncachestore 748 Local clone with fncachestore
717 $ hg clone -U deeprepo local-clone-fncachestore 749 $ hg clone -U deeprepo local-clone-fncachestore
718 $ hg -R local-clone-fncachestore verify 750 $ hg -R local-clone-fncachestore verify
719 checking changesets 751 checking changesets
720 checking manifests 752 checking manifests
721 checking directory manifests 753 checking directory manifests
722 crosschecking files in changesets and manifests 754 crosschecking files in changesets and manifests
723 checking files 755 checking files
724 8 files, 3 changesets, 10 total revisions 756 8 files, 4 changesets, 18 total revisions
725 757
726 Stream clone with basicstore 758 Stream clone with basicstore
727 $ hg clone --config experimental.changegroup3=True --uncompressed -U \ 759 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
728 > http://localhost:$HGPORT1 stream-clone-basicstore 760 > http://localhost:$HGPORT1 stream-clone-basicstore
729 streaming all changes 761 streaming all changes
735 checking changesets 767 checking changesets
736 checking manifests 768 checking manifests
737 checking directory manifests 769 checking directory manifests
738 crosschecking files in changesets and manifests 770 crosschecking files in changesets and manifests
739 checking files 771 checking files
740 8 files, 3 changesets, 10 total revisions 772 8 files, 4 changesets, 18 total revisions
741 773
742 Stream clone with encodedstore 774 Stream clone with encodedstore
743 $ hg clone --config experimental.changegroup3=True --uncompressed -U \ 775 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
744 > http://localhost:$HGPORT2 stream-clone-encodedstore 776 > http://localhost:$HGPORT2 stream-clone-encodedstore
745 streaming all changes 777 streaming all changes
751 checking changesets 783 checking changesets
752 checking manifests 784 checking manifests
753 checking directory manifests 785 checking directory manifests
754 crosschecking files in changesets and manifests 786 crosschecking files in changesets and manifests
755 checking files 787 checking files
756 8 files, 3 changesets, 10 total revisions 788 8 files, 4 changesets, 18 total revisions
757 789
758 Stream clone with fncachestore 790 Stream clone with fncachestore
759 $ hg clone --config experimental.changegroup3=True --uncompressed -U \ 791 $ hg clone --config experimental.changegroup3=True --uncompressed -U \
760 > http://localhost:$HGPORT stream-clone-fncachestore 792 > http://localhost:$HGPORT stream-clone-fncachestore
761 streaming all changes 793 streaming all changes
767 checking changesets 799 checking changesets
768 checking manifests 800 checking manifests
769 checking directory manifests 801 checking directory manifests
770 crosschecking files in changesets and manifests 802 crosschecking files in changesets and manifests
771 checking files 803 checking files
772 8 files, 3 changesets, 10 total revisions 804 8 files, 4 changesets, 18 total revisions
773 805
774 Packed bundle 806 Packed bundle
775 $ hg -R deeprepo debugcreatestreamclonebundle repo-packed.hg 807 $ hg -R deeprepo debugcreatestreamclonebundle repo-packed.hg
776 writing 3349 bytes for 18 files 808 writing 5330 bytes for 18 files
777 bundle requirements: generaldelta, revlogv1, treemanifest 809 bundle requirements: generaldelta, revlogv1, treemanifest
778 $ hg debugbundle --spec repo-packed.hg 810 $ hg debugbundle --spec repo-packed.hg
779 none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Ctreemanifest 811 none-packed1;requirements%3Dgeneraldelta%2Crevlogv1%2Ctreemanifest
780 812
781 Bundle with changegroup2 is not supported 813 Bundle with changegroup2 is not supported