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

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 00:17:06 UTC
  • mto: (6670.4.8 move-bzr)
  • mto: This revision was merged to the branch mainline in revision 6681.
  • Revision ID: jelmer@jelmer.uk-20170610001706-xn6jiuev350246mr
Rename a number of attributes from bzrdir to controldir.

Show diffs side-by-side

added added

removed removed

Lines of Context:
160
160
        readonly_t = self.get_readonly_transport()
161
161
        made_control = self.bzrdir_format.initialize(t.base)
162
162
        made_repo = self.repository_format.initialize(made_control)
163
 
        self.assertEqual(made_control, made_repo.bzrdir)
 
163
        self.assertEqual(made_control, made_repo.controldir)
164
164
 
165
165
        # find it via controldir opening:
166
166
        opened_control = controldir.ControlDir.open(readonly_t.base)
167
167
        direct_opened_repo = opened_control.open_repository()
168
168
        self.assertEqual(direct_opened_repo.__class__, made_repo.__class__)
169
 
        self.assertEqual(opened_control, direct_opened_repo.bzrdir)
 
169
        self.assertEqual(opened_control, direct_opened_repo.controldir)
170
170
 
171
171
        self.assertIsInstance(direct_opened_repo._format,
172
172
                              self.repository_format.__class__)
221
221
        made_repo = made_control.create_repository()
222
222
        # Check that we have a repository object.
223
223
        made_repo.has_revision('foo')
224
 
        self.assertEqual(made_control, made_repo.bzrdir)
 
224
        self.assertEqual(made_control, made_repo.controldir)
225
225
 
226
226
    def test_create_repository_shared(self):
227
227
        # bzrdir can construct a shared repository.
240
240
            return
241
241
        # Check that we have a repository object.
242
242
        made_repo.has_revision('foo')
243
 
        self.assertEqual(made_control, made_repo.bzrdir)
 
243
        self.assertEqual(made_control, made_repo.controldir)
244
244
        self.assertTrue(made_repo.is_shared())
245
245
 
246
246
    def test_revision_tree(self):
312
312
        # Check that we have a repository object.
313
313
        made_repo.has_revision('foo')
314
314
 
315
 
        self.assertEqual(made_control, made_repo.bzrdir)
 
315
        self.assertEqual(made_control, made_repo.controldir)
316
316
        self.assertTrue(result.open_repository().is_shared())
317
317
        self.assertFalse(result.open_repository().make_working_trees())
318
318
 
339
339
            # it would be nice to have a 'latest' vs 'default' concept.
340
340
            format = controldir.format_registry.make_bzrdir(
341
341
                'development-subtree')
342
 
            upgrade.upgrade(repo.bzrdir.root_transport.base, format=format)
 
342
            upgrade.upgrade(repo.controldir.root_transport.base, format=format)
343
343
        except errors.UpToDateFormat:
344
344
            # this is in the most current format already.
345
345
            return
499
499
        # |/
500
500
        # C
501
501
        tree.commit('initial commit', rev_id='A')
502
 
        tree_other = tree.bzrdir.sprout('there').open_workingtree()
 
502
        tree_other = tree.controldir.sprout('there').open_workingtree()
503
503
        tree_other.commit('another', rev_id='B')
504
504
        tree.merge_from_branch(tree_other.branch)
505
505
        tree.commit('another', rev_id='C')
569
569
        self.start_server(smart_server, self.get_server())
570
570
        remote_transport = transport.get_transport_from_url(
571
571
            smart_server.get_url()).clone(path)
572
 
        if not repo.bzrdir._format.supports_transport(remote_transport):
 
572
        if not repo.controldir._format.supports_transport(remote_transport):
573
573
            raise tests.TestNotApplicable(
574
574
                "format does not support transport")
575
575
        remote_bzrdir = controldir.ControlDir.open_from_transport(
599
599
            raise tests.TestNotApplicable(
600
600
                "Format can not be used over HPSS")
601
601
        remote_repo = self.make_remote_repository('remote')
602
 
        remote_branch = remote_repo.bzrdir.create_branch()
 
602
        remote_branch = remote_repo.controldir.create_branch()
603
603
        try:
604
 
            local_bzrdir = remote_branch.bzrdir.sprout('local')
 
604
            local_bzrdir = remote_branch.controldir.sprout('local')
605
605
        except errors.TransportNotPossible:
606
606
            raise tests.TestNotApplicable(
607
607
                "Cannot lock_read old formats like AllInOne over HPSS.")
624
624
        # Make a branch in that repo in an old format that isn't the default
625
625
        # branch format for the repo.
626
626
        from breezy.branchfmt.fullhistory import BzrBranchFormat5
627
 
        format = remote_backing_repo.bzrdir.cloning_metadir()
 
627
        format = remote_backing_repo.controldir.cloning_metadir()
628
628
        format._branch_format = BzrBranchFormat5()
629
 
        remote_transport = remote_repo.bzrdir.root_transport.clone('branch')
 
629
        remote_transport = remote_repo.controldir.root_transport.clone('branch')
630
630
        controldir.ControlDir.create_branch_convenience(
631
631
            remote_transport.base, force_new_repo=False, format=format)
632
632
        remote_branch = controldir.ControlDir.open_from_transport(
633
633
            remote_transport).open_branch()
634
634
        try:
635
 
            local_bzrdir = remote_branch.bzrdir.sprout('local')
 
635
            local_bzrdir = remote_branch.controldir.sprout('local')
636
636
        except errors.TransportNotPossible:
637
637
            raise tests.TestNotApplicable(
638
638
                "Cannot lock_read old formats like AllInOne over HPSS.")
659
659
            repo = self.make_repository('repo', shared=True)
660
660
        except errors.IncompatibleFormat:
661
661
            raise tests.TestNotApplicable('Cannot make a shared repository')
662
 
        if repo.bzrdir._format.fixed_components:
 
662
        if repo.controldir._format.fixed_components:
663
663
            self.knownFailure(
664
664
                "pre metadir branches do not upgrade on push "
665
665
                "with stacking policy")
679
679
            info_repo = repo._real_repository
680
680
        else:
681
681
            info_repo = repo
682
 
        format_description = info.describe_format(info_repo.bzrdir,
 
682
        format_description = info.describe_format(info_repo.controldir,
683
683
            info_repo, None, None)
684
684
        formats = format_description.split(' or ')
685
685
        stack_on_format = formats[0]
692
692
        # format as-is.
693
693
        stack_on = self.make_branch('stack-on-me', format=stack_on_format)
694
694
        self.make_bzrdir('.').get_config().set_default_stack_on('stack-on-me')
695
 
        target = branch.bzrdir.clone(self.get_url('target'))
 
695
        target = branch.controldir.clone(self.get_url('target'))
696
696
        # The target branch supports stacking.
697
697
        self.assertTrue(target.open_branch()._format.supports_stacking())
698
698
        if isinstance(repo, remote.RemoteRepository):
778
778
            raise tests.TestNotApplicable("format does not support standalone "
779
779
                "repositories")
780
780
        try:
781
 
            repo.bzrdir.open_branch()
 
781
            repo.controldir.open_branch()
782
782
        except errors.NotBranchError:
783
783
            self.assertEqual([], repo.find_branches(using=True))
784
784
        else:
785
 
            self.assertEqual([repo.bzrdir.root_transport.base],
 
785
            self.assertEqual([repo.controldir.root_transport.base],
786
786
                             [b.base for b in repo.find_branches(using=True)])
787
787
 
788
788
    def test_set_get_make_working_trees_true(self):
845
845
            repo.unlock()
846
846
        # Reacquire the lock (with a different repository object) by using the
847
847
        # token.
848
 
        new_repo = repo.bzrdir.open_repository()
 
848
        new_repo = repo.controldir.open_repository()
849
849
        new_repo.lock_write(token=token)
850
850
        # Call dont_leave_lock_in_place, so that the lock will be released by
851
851
        # this instance, even though the lock wasn't originally acquired by it.