/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

merge with get_file_sha1

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
from bzrlib import errors, tests, workingtree_4
23
23
from bzrlib.osutils import file_kind, has_symlinks
 
24
from bzrlib.tests import TestNotApplicable
24
25
from bzrlib.tests.intertree_implementations import TestCaseWithTwoTrees
25
26
 
26
27
# TODO: test the include_root option.
696
697
            ])
697
698
        self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
698
699
 
 
700
    def test_only_in_source_and_missing(self):
 
701
        tree1 = self.make_branch_and_tree('tree1')
 
702
        tree2 = self.make_to_branch_and_tree('tree2')
 
703
        tree2.set_root_id(tree1.get_root_id())
 
704
        self.build_tree(['tree1/file'])
 
705
        tree1.add(['file'], ['file-id'])
 
706
        os.unlink('tree1/file')
 
707
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
708
        root_id = tree1.path2id('')
 
709
        if not tree1.path2id('file'):
 
710
            # The locked test trees conversion could not preserve the missing
 
711
            # file status. This is normal (e.g. InterDirstateTree falls back
 
712
            # to InterTree if the basis is not a DirstateRevisionTree, and
 
713
            # revision trees cannot have missing files. 
 
714
            raise TestNotApplicable()
 
715
        expected = [('file-id', ('file', None), False, (True, False),
 
716
            (root_id, None), ('file', None), (None, None), (False, None))]
 
717
        self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
 
718
 
 
719
    def test_only_in_target_and_missing(self):
 
720
        tree1 = self.make_branch_and_tree('tree1')
 
721
        tree2 = self.make_to_branch_and_tree('tree2')
 
722
        tree2.set_root_id(tree1.get_root_id())
 
723
        self.build_tree(['tree2/file'])
 
724
        tree2.add(['file'], ['file-id'])
 
725
        os.unlink('tree2/file')
 
726
        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
 
727
        root_id = tree1.path2id('')
 
728
        expected = [('file-id', (None, 'file'), False, (False, True),
 
729
            (None, root_id), (None, 'file'), (None, None), (None, False))]
 
730
        self.assertEqual(expected, self.do_iter_changes(tree1, tree2))
 
731
 
699
732
    def test_unchanged_with_renames_and_modifications(self):
700
733
        """want_unchanged should generate a list of unchanged entries."""
701
734
        tree1 = self.make_branch_and_tree('1')