~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Fixes for some comparison tests; repr of DirStateRevisionTree

Show diffs side-by-side

added added

removed removed

Lines of Context:
299
299
    def test_default_ignores_unversioned_files(self):
300
300
        tree1 = self.make_branch_and_tree('tree1')
301
301
        tree2 = self.make_to_branch_and_tree('tree2')
 
302
        tree2.set_root_id(tree1.get_root_id())
302
303
        self.build_tree(['tree1/a', 'tree1/c',
303
304
                         'tree2/a', 'tree2/b', 'tree2/c'])
304
305
        tree1.add(['a', 'c'], ['a-id', 'c-id'])
317
318
    def test_unversioned_paths_in_tree(self):
318
319
        tree1 = self.make_branch_and_tree('tree1')
319
320
        tree2 = self.make_to_branch_and_tree('tree2')
 
321
        tree2.set_root_id(tree1.get_root_id())
320
322
        self.build_tree(['tree2/file', 'tree2/dir/'])
321
323
        # try:
322
324
        os.symlink('target', 'tree2/link')
714
716
        subtree2 = self.make_to_branch_and_tree('2/sub')
715
717
        subtree2.set_root_id('subtree-id')
716
718
        tree2.add_reference(subtree2)
717
 
        self.assertEqual([], list(tree2._iter_changes(tree1)))
718
 
        subtree1.commit('commit', rev_id='commit-a')
719
 
        self.assertEqual([('subtree-id',
720
 
                           'sub',
721
 
                           True,
722
 
                           (True, True),
723
 
                           ('root-id', 'root-id'),
724
 
                           ('sub', 'sub'),
725
 
                           ('tree-reference', 'tree-reference'),
726
 
                           (False, False))], 
727
 
                         list(tree2._iter_changes(tree1)))
 
719
        tree1.lock_read()
 
720
        tree2.lock_read()
 
721
        try:
 
722
            self.assertEqual([], list(tree2._iter_changes(tree1)))
 
723
            subtree1.commit('commit', rev_id='commit-a')
 
724
            self.assertEqual([('subtree-id',
 
725
                               'sub',
 
726
                               True,
 
727
                               (True, True),
 
728
                               ('root-id', 'root-id'),
 
729
                               ('sub', 'sub'),
 
730
                               ('tree-reference', 'tree-reference'),
 
731
                               (False, False))],
 
732
                             list(tree2._iter_changes(tree1)))
 
733
        finally:
 
734
            tree1.unlock()
 
735
            tree2.unlock()
728
736
 
729
737
    def test_default_ignores_unversioned_files(self):
730
738
        tree1 = self.make_branch_and_tree('tree1')
751
759
    def test_unversioned_paths_in_tree(self):
752
760
        tree1 = self.make_branch_and_tree('tree1')
753
761
        tree2 = self.make_to_branch_and_tree('tree2')
 
762
        tree2.set_root_id(tree1.get_root_id())
754
763
        self.build_tree(['tree2/file', 'tree2/dir/'])
755
764
        # try:
756
765
        os.symlink('target', 'tree2/link')