~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-22 01:36:42 UTC
  • mfrom: (4544.2.2 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090722013642-hejy07x9ub06tioj
(robertc) Add interface enforcement for the behaviour of iter_changes
        with missing subtrees with explicit paths - the whole subtree
        is returned. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
757
757
            (None, root_id), (None, 'file'), (None, None), (None, False))]
758
758
        self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
759
759
 
 
760
    def test_only_in_target_missing_subtree_specific_bug_367632(self):
 
761
        tree1 = self.make_branch_and_tree('tree1')
 
762
        tree2 = self.make_to_branch_and_tree('tree2')
 
763
        tree2.set_root_id(tree1.get_root_id())
 
764
        self.build_tree(['tree2/a-dir/', 'tree2/a-dir/a-file'])
 
765
        tree2.add(['a-dir', 'a-dir/a-file'], ['dir-id', 'file-id'])
 
766
        os.unlink('tree2/a-dir/a-file')
 
767
        os.rmdir('tree2/a-dir')
 
768
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
769
        self.not_applicable_if_missing_in('a-dir', tree2)
 
770
        root_id = tree1.path2id('')
 
771
        expected = [
 
772
            ('dir-id', (None, 'a-dir'), False, (False, True),
 
773
            (None, root_id), (None, 'a-dir'), (None, None), (None, False)),
 
774
            ('file-id', (None, 'a-dir/a-file'), False, (False, True),
 
775
            (None, 'dir-id'), (None, 'a-file'), (None, None), (None, False))
 
776
            ]
 
777
        # bug 367632 showed that specifying the root broke some code paths,
 
778
        # so we check this contract with and without it.
 
779
        self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
 
780
        self.assertEqual(expected,
 
781
            self.do_iter_changes(tree1, tree2, specific_files=['']))
 
782
 
760
783
    def test_unchanged_with_renames_and_modifications(self):
761
784
        """want_unchanged should generate a list of unchanged entries."""
762
785
        tree1 = self.make_branch_and_tree('1')
765
788
        tree2 = self.get_tree_no_parents_abc_content_5(tree2)
766
789
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
767
790
        root_id = tree1.path2id('')
768
 
 
769
791
        self.assertEqual(sorted([self.unchanged(tree1, root_id),
770
792
            self.unchanged(tree1, 'b-id'),
771
793
            ('a-id', ('a', 'd'), True, (True, True),