~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack_repository.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-08-29 21:40:33 UTC
  • mfrom: (3665.2.3 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080829214033-n9tclw44g7b42hsc
(jam) Merge bzr-1.6.1rc1

Show diffs side-by-side

added added

removed removed

Lines of Context:
497
497
    def get_format(self):
498
498
        return bzrdir.format_registry.make_bzrdir(self.format_name)
499
499
 
500
 
    def test_stack_checks_compatibility(self):
 
500
    def test_stack_checks_rich_root_compatibility(self):
501
501
        # early versions of the packing code relied on pack internals to
502
502
        # stack, but the current version should be able to stack on any
503
503
        # format.
509
509
        if repo.supports_rich_root():
510
510
            # can only stack on repositories that have compatible internal
511
511
            # metadata
512
 
            matching_format_name = 'pack-0.92-subtree'
 
512
            if getattr(repo._format, 'supports_tree_reference', False):
 
513
                matching_format_name = 'pack-0.92-subtree'
 
514
            else:
 
515
                matching_format_name = 'rich-root-pack'
513
516
            mismatching_format_name = 'pack-0.92'
514
517
        else:
515
518
            matching_format_name = 'pack-0.92'
526
529
            r'KnitPackRepository.*/repo/.*\n'
527
530
            r'different rich-root support')
528
531
 
 
532
    def test_stack_checks_serializers_compatibility(self):
 
533
        repo = self.make_repository('repo', format=self.get_format())
 
534
        if getattr(repo._format, 'supports_tree_reference', False):
 
535
            # can only stack on repositories that have compatible internal
 
536
            # metadata
 
537
            matching_format_name = 'pack-0.92-subtree'
 
538
            mismatching_format_name = 'rich-root-pack'
 
539
        else:
 
540
            if repo.supports_rich_root():
 
541
                matching_format_name = 'rich-root-pack'
 
542
                mismatching_format_name = 'pack-0.92-subtree'
 
543
            else:
 
544
                raise TestNotApplicable('No formats use non-v5 serializer'
 
545
                    ' without having rich-root also set')
 
546
        base = self.make_repository('base', format=matching_format_name)
 
547
        repo.add_fallback_repository(base)
 
548
        # you can't stack on something with incompatible data
 
549
        bad_repo = self.make_repository('mismatch',
 
550
            format=mismatching_format_name)
 
551
        e = self.assertRaises(errors.IncompatibleRepositories,
 
552
            repo.add_fallback_repository, bad_repo)
 
553
        self.assertContainsRe(str(e),
 
554
            r'(?m)KnitPackRepository.*/mismatch/.*\nis not compatible with\n'
 
555
            r'KnitPackRepository.*/repo/.*\n'
 
556
            r'different serializers')
 
557
 
529
558
    def test_adding_pack_does_not_record_pack_names_from_other_repositories(self):
530
559
        base = self.make_branch_and_tree('base', format=self.get_format())
531
560
        base.commit('foo')
592
621
         dict(format_name='1.6',
593
622
              format_string="Bazaar RepositoryFormatKnitPack5 (bzr 1.6)\n",
594
623
              format_supports_external_lookups=True),
595
 
         dict(format_name='1.6-rich-root',
 
624
         dict(format_name='1.6.1-rich-root',
596
625
              format_string="Bazaar RepositoryFormatKnitPack5RichRoot "
597
 
                  "(bzr 1.6)\n",
 
626
                  "(bzr 1.6.1)\n",
598
627
              format_supports_external_lookups=True),
599
628
         dict(format_name='development0',
600
629
              format_string="Bazaar development format 0 "