~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/intertree_implementations/test_compare.py

  • Committer: Robert Collins
  • Date: 2007-03-09 01:52:01 UTC
  • mto: (2323.3.2 0.15)
  • mto: This revision was merged to the branch mainline in revision 2368.
  • Revision ID: robertc@robertcollins.net-20070309015201-18fbvytw3qi0fh09
Fix the behaviour of dirstate optimised iter_changes recursing its disk iterator into subtrees inappropriately.

Show diffs side-by-side

added added

removed removed

Lines of Context:
700
700
            self.do_iter_changes(tree1, tree2, include_unchanged=True))
701
701
 
702
702
    def test_compare_subtrees(self):
703
 
        """want_unchanged should generate a list of unchanged entries."""
704
703
        tree1 = self.make_branch_and_tree('1')
705
704
        if not tree1.supports_tree_reference():
706
 
            raise tests.TestSkipped('Tree %s does not support references'
707
 
                % (tree1,))
 
705
            return
708
706
        tree1.set_root_id('root-id')
709
707
        subtree1 = self.make_branch_and_tree('1/sub')
710
708
        subtree1.set_root_id('subtree-id')
712
710
 
713
711
        tree2 = self.make_to_branch_and_tree('2')
714
712
        if not tree2.supports_tree_reference():
715
 
            raise tests.TestSkipped('Tree %s does not support references'
716
 
                % (tree2,))
 
713
            return
717
714
        tree2.set_root_id('root-id')
718
715
        subtree2 = self.make_to_branch_and_tree('2/sub')
719
716
        subtree2.set_root_id('subtree-id')
745
742
                         list(tree2._iter_changes(tree1,
746
743
                             include_unchanged=True)))
747
744
 
 
745
    def test_disk_in_subtrees_skipped(self):
 
746
        """subtrees are considered not-in-the-current-tree.
 
747
        
 
748
        This test tests the trivial case, where the basis has no paths in the
 
749
        current trees subtree.
 
750
        """
 
751
        tree1 = self.make_branch_and_tree('1')
 
752
        tree1.set_root_id('root-id')
 
753
        tree2 = self.make_to_branch_and_tree('2')
 
754
        if not tree2.supports_tree_reference():
 
755
            return
 
756
        tree2.set_root_id('root-id')
 
757
        subtree2 = self.make_to_branch_and_tree('2/sub')
 
758
        subtree2.set_root_id('subtree-id')
 
759
        tree2.add(['sub'], ['subtree-id'])
 
760
        self.build_tree(['2/sub/file'])
 
761
        subtree2.add(['file'])
 
762
        tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
 
763
        tree1.lock_read()
 
764
        self.addCleanup(tree1.unlock)
 
765
        tree2.lock_read()
 
766
        self.addCleanup(tree2.unlock)
 
767
        # this should filter correctly from above
 
768
        self.assertEqual([self.added(tree2, 'subtree-id')],
 
769
            self.do_iter_changes(tree1, tree2, want_unversioned=True))
 
770
        # and when the path is named
 
771
        self.assertEqual([self.added(tree2, 'subtree-id')],
 
772
            self.do_iter_changes(tree1, tree2, specific_files=['sub'],
 
773
                want_unversioned=True))
 
774
 
748
775
    def test_default_ignores_unversioned_files(self):
749
776
        tree1 = self.make_branch_and_tree('tree1')
750
777
        tree2 = self.make_to_branch_and_tree('tree2')