~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_pack_repository.py

  • Committer: Robert Collins
  • Date: 2008-09-02 05:28:37 UTC
  • mfrom: (3675 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3677.
  • Revision ID: robertc@robertcollins.net-20080902052837-ec3qlv41q5e7f6fl
Resolve conflicts with NEWS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
        """Packs do not need ordered data retrieval."""
66
66
        format = self.get_format()
67
67
        repo = self.make_repository('.', format=format)
68
 
        self.assertEqual('unsorted', repo._fetch_order)
 
68
        self.assertEqual('unordered', repo._fetch_order)
69
69
 
70
70
    def test_attribute__fetch_uses_deltas(self):
71
71
        """Packs reuse deltas."""
413
413
    def test_break_lock_breaks_physical_lock(self):
414
414
        repo = self.make_repository('.', format=self.get_format())
415
415
        repo._pack_collection.lock_names()
 
416
        repo.control_files.leave_in_place()
 
417
        repo.unlock()
416
418
        repo2 = repository.Repository.open('.')
417
419
        self.assertTrue(repo.get_physical_lock_status())
418
420
        self.prepare_for_break_lock()
495
497
    def get_format(self):
496
498
        return bzrdir.format_registry.make_bzrdir(self.format_name)
497
499
 
498
 
    def test_stack_checks_compatibility(self):
 
500
    def test_stack_checks_rich_root_compatibility(self):
499
501
        # early versions of the packing code relied on pack internals to
500
502
        # stack, but the current version should be able to stack on any
501
503
        # format.
507
509
        if repo.supports_rich_root():
508
510
            # can only stack on repositories that have compatible internal
509
511
            # metadata
510
 
            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'
511
516
            mismatching_format_name = 'pack-0.92'
512
517
        else:
513
518
            matching_format_name = 'pack-0.92'
524
529
            r'KnitPackRepository.*/repo/.*\n'
525
530
            r'different rich-root support')
526
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
 
527
558
    def test_adding_pack_does_not_record_pack_names_from_other_repositories(self):
528
559
        base = self.make_branch_and_tree('base', format=self.get_format())
529
560
        base.commit('foo')
590
621
         dict(format_name='1.6',
591
622
              format_string="Bazaar RepositoryFormatKnitPack5 (bzr 1.6)\n",
592
623
              format_supports_external_lookups=True),
593
 
         dict(format_name='1.6-rich-root',
 
624
         dict(format_name='1.6.1-rich-root',
594
625
              format_string="Bazaar RepositoryFormatKnitPack5RichRoot "
595
 
                  "(bzr 1.6)\n",
 
626
                  "(bzr 1.6.1)\n",
596
627
              format_supports_external_lookups=True),
597
628
         dict(format_name='development0',
598
629
              format_string="Bazaar development format 0 "