/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/test_repository.py

  • Committer: Martin Pool
  • Date: 2009-08-26 05:38:16 UTC
  • mfrom: (4634.6.2 2.0)
  • mto: (4634.6.4 2.0)
  • mto: This revision was merged to the branch mainline in revision 4660.
  • Revision ID: mbp@sourcefrog.net-20090826053816-ht6jpktdm77vi6t5
MergeĀ 2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
486
486
    _serializer = None
487
487
 
488
488
    def supports_rich_root(self):
 
489
        if self._format is not None:
 
490
            return self._format.rich_root_data
489
491
        return False
490
492
 
491
493
    def get_graph(self):
542
544
        # pair that it returns true on for the is_compatible static method
543
545
        # check
544
546
        dummy_a = DummyRepository()
 
547
        dummy_a._format = RepositoryFormat()
545
548
        dummy_b = DummyRepository()
 
549
        dummy_b._format = RepositoryFormat()
546
550
        repo = self.make_repository('.')
547
551
        # hack dummies to look like repo somewhat.
548
552
        dummy_a._serializer = repo._serializer
 
553
        dummy_a._format.supports_tree_reference = repo._format.supports_tree_reference
 
554
        dummy_a._format.rich_root_data = repo._format.rich_root_data
549
555
        dummy_b._serializer = repo._serializer
 
556
        dummy_b._format.supports_tree_reference = repo._format.supports_tree_reference
 
557
        dummy_b._format.rich_root_data = repo._format.rich_root_data
550
558
        repository.InterRepository.register_optimiser(InterDummy)
551
559
        try:
552
560
            # we should get the default for something InterDummy returns False
1008
1016
        """
1009
1017
        broken_repo = self.make_broken_repository()
1010
1018
        empty_repo = self.make_repository('empty-repo')
1011
 
        # See bug https://bugs.launchpad.net/bzr/+bug/389141 for information
1012
 
        # about why this was turned into expectFailure
1013
 
        self.expectFailure('new Stream fetch fills in missing compression'
1014
 
           ' parents (bug #389141)',
1015
 
           self.assertRaises, (errors.RevisionNotPresent, errors.BzrCheckError),
1016
 
                              empty_repo.fetch, broken_repo)
1017
 
        self.assertRaises((errors.RevisionNotPresent, errors.BzrCheckError),
1018
 
                          empty_repo.fetch, broken_repo)
 
1019
        try:
 
1020
            empty_repo.fetch(broken_repo)
 
1021
        except (errors.RevisionNotPresent, errors.BzrCheckError):
 
1022
            # Test successful: compression parent not being copied leads to
 
1023
            # error.
 
1024
            return
 
1025
        empty_repo.lock_read()
 
1026
        self.addCleanup(empty_repo.unlock)
 
1027
        text = empty_repo.texts.get_record_stream(
 
1028
            [('file2-id', 'rev3')], 'topological', True).next()
 
1029
        self.assertEqual('line\n', text.get_bytes_as('fulltext'))
1019
1030
 
1020
1031
 
1021
1032
class TestRepositoryPackCollection(TestCaseWithTransport):
1030
1041
 
1031
1042
    def make_packs_and_alt_repo(self, write_lock=False):
1032
1043
        """Create a pack repo with 3 packs, and access it via a second repo."""
1033
 
        tree = self.make_branch_and_tree('.')
 
1044
        tree = self.make_branch_and_tree('.', format=self.get_format())
1034
1045
        tree.lock_write()
1035
1046
        self.addCleanup(tree.unlock)
1036
1047
        rev1 = tree.commit('one')
1346
1357
    """Tests for the packs repository Packer class."""
1347
1358
 
1348
1359
    def test_pack_optimizes_pack_order(self):
1349
 
        builder = self.make_branch_builder('.')
 
1360
        builder = self.make_branch_builder('.', format="1.9")
1350
1361
        builder.start_series()
1351
1362
        builder.build_snapshot('A', None, [
1352
1363
            ('add', ('', 'root-id', 'directory', None)),