/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/bzrdir_implementations/test_bzrdir.py

merge bzr.dev r3564

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    workingtree,
37
37
    )
38
38
from bzrlib.branch import Branch, needs_read_lock, needs_write_lock
39
 
from bzrlib.check import check
 
39
from bzrlib.check import check_branch
40
40
from bzrlib.errors import (FileExists,
41
41
                           NoSuchRevision,
42
42
                           NoSuchFile,
125
125
                    self.assertEqual(left_repo.get_revision(rev_id),
126
126
                        right_repo.get_revision(rev_id))
127
127
                # inventories
128
 
                left_inv_weave = left_repo.get_inventory_weave()
129
 
                right_inv_weave = right_repo.get_inventory_weave()
130
 
                self.assertEqual(set(left_inv_weave.versions()),
131
 
                    set(right_inv_weave.versions()))
 
128
                left_inv_weave = left_repo.inventories
 
129
                right_inv_weave = right_repo.inventories
 
130
                self.assertEqual(set(left_inv_weave.keys()),
 
131
                    set(right_inv_weave.keys()))
132
132
                # XXX: currently this does not handle indirectly referenced
133
133
                # inventories (e.g. where the inventory is a delta basis for
134
134
                # one that is fully present but that the revid for that
135
135
                # inventory is not yet present.)
136
 
                self.assertEqual(set(left_inv_weave.versions()), set(all_revs))
 
136
                self.assertEqual(set(left_inv_weave.keys()),
 
137
                    set(left_repo.revisions.keys()))
137
138
                left_trees = left_repo.revision_trees(all_revs)
138
139
                right_trees = right_repo.revision_trees(all_revs)
139
140
                for left_tree, right_tree in izip(left_trees, right_trees):
142
143
                text_index = left_repo._generate_text_key_index()
143
144
                self.assertEqual(text_index,
144
145
                    right_repo._generate_text_key_index())
 
146
                desired_files = []
145
147
                for file_id, revision_id in text_index.iterkeys():
146
 
                    left_weave = left_repo.weave_store.get_weave(
147
 
                        file_id, left_repo.get_transaction())
148
 
                    right_weave = right_repo.weave_store.get_weave(
149
 
                        file_id, right_repo.get_transaction())
150
 
                    self.assertEqual(
151
 
                        left_weave.get_text(revision_id),
152
 
                        right_weave.get_text(revision_id))
 
148
                    desired_files.append(
 
149
                        (file_id, revision_id, (file_id, revision_id)))
 
150
                left_texts = list(left_repo.iter_files_bytes(desired_files))
 
151
                right_texts = list(right_repo.iter_files_bytes(desired_files))
 
152
                left_texts.sort()
 
153
                right_texts.sort()
 
154
                self.assertEqual(left_texts, right_texts)
153
155
                # signatures
154
156
                for rev_id in all_revs:
155
157
                    try:
306
308
                                     './.bzr/merge-hashes',
307
309
                                     './.bzr/repository',
308
310
                                     ])
309
 
        self.assertRepositoryHasSameItems(tree.branch.repository, repo)
 
311
        self.assertRepositoryHasSameItems(tree.branch.repository,
 
312
            target.open_repository())
310
313
 
311
314
    def test_clone_bzrdir_repository_under_shared(self):
312
315
        tree = self.make_branch_and_tree('commit_tree')
549
552
        target_transport = a_dir.root_transport.clone('..').clone('target')
550
553
        target_bzrdir = a_dir.clone_on_transport(target_transport)
551
554
        target_repo = target_bzrdir.open_repository()
 
555
        source_branch = bzrlib.branch.Branch.open(
 
556
            self.get_vfs_only_url('source'))
552
557
        self.assertEqual(target_repo._format, source_branch.repository._format)
553
558
 
554
559
    def test_revert_inventory(self):
1481
1486
            finally:
1482
1487
                pb.finished()
1483
1488
            # and it should pass 'check' now.
1484
 
            check(bzrdir.BzrDir.open(self.get_url('.')).open_branch(), False)
 
1489
            check_branch(bzrdir.BzrDir.open(self.get_url('.')).open_branch(),
 
1490
                         False)
1485
1491
 
1486
1492
    def test_format_description(self):
1487
1493
        dir = self.make_bzrdir('.')
1627
1633
        self.assertRaises(errors.LockBroken, tree.unlock)
1628
1634
 
1629
1635
 
 
1636
class TestTransportConfig(TestCaseWithBzrDir):
 
1637
 
 
1638
    def test_get_config(self):
 
1639
        my_dir = self.make_bzrdir('.')
 
1640
        config = my_dir.get_config()
 
1641
        if config is None:
 
1642
            self.assertFalse(isinstance(my_dir, bzrdir.BzrDirMeta1))
 
1643
            raise TestNotApplicable(
 
1644
                'This BzrDir format does not support configs.')
 
1645
        config.set_default_stack_on('http://example.com')
 
1646
        self.assertEqual('http://example.com', config.get_default_stack_on())
 
1647
        my_dir2 = bzrdir.BzrDir.open('.')
 
1648
        config2 = my_dir2.get_config()
 
1649
        self.assertEqual('http://example.com', config2.get_default_stack_on())
 
1650
 
 
1651
 
1630
1652
class ChrootedBzrDirTests(ChrootedTestCase):
1631
1653
 
1632
1654
    def test_find_repository_no_repository(self):