/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/blackbox/test_info.py

  • Committer: Jelmer Vernooij
  • Date: 2017-06-10 16:40:42 UTC
  • mfrom: (6653.6.7 rename-controldir)
  • mto: This revision was merged to the branch mainline in revision 6690.
  • Revision ID: jelmer@jelmer.uk-20170610164042-zrxqgy2htyduvke2
MergeĀ rename-controldirĀ branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        self.assertEqual(err, 'brz: ERROR: Not a branch: "%s".\n' % location)
52
52
 
53
53
    def test_info_empty_controldir(self):
54
 
        self.make_bzrdir('ctrl')
 
54
        self.make_controldir('ctrl')
55
55
        out, err = self.run_bzr('info ctrl')
56
56
        self.assertEqual(out,
57
57
            'Empty control directory (format: 2a or pack-0.92)\n'
60
60
        self.assertEqual(err, '')
61
61
 
62
62
    def test_info_empty_controldir_verbose(self):
63
 
        self.make_bzrdir('ctrl')
 
63
        self.make_controldir('ctrl')
64
64
        out, err = self.run_bzr('info -v ctrl')
65
65
        self.assertEqualDiff(out,
66
66
            'Empty control directory (format: 2a or pack-0.92)\n'
174
174
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
175
175
 
176
176
        # Branch standalone with push location
177
 
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
178
 
        branch2.set_push_location(branch1.bzrdir.root_transport.base)
 
177
        branch2 = branch1.controldir.sprout('branch').open_branch()
 
178
        branch2.set_push_location(branch1.controldir.root_transport.base)
179
179
 
180
180
        out, err = self.run_bzr('info branch')
181
181
        self.assertEqualDiff(
232
232
 
233
233
        # Branch and bind to standalone, needs upgrade to metadir
234
234
        # (creates backup as unknown)
235
 
        branch1.bzrdir.sprout('bound')
236
 
        knit1_format = controldir.format_registry.make_bzrdir('knit')
 
235
        branch1.controldir.sprout('bound')
 
236
        knit1_format = controldir.format_registry.make_controldir('knit')
237
237
        upgrade.upgrade('bound', knit1_format)
238
238
        branch3 = controldir.ControlDir.open('bound').open_branch()
239
239
        branch3.bind(branch1)
240
 
        bound_tree = branch3.bzrdir.open_workingtree()
 
240
        bound_tree = branch3.controldir.open_workingtree()
241
241
        out, err = self.run_bzr('info -v bound')
242
242
        self.assertEqualDiff(
243
243
"""Checkout (format: knit)
286
286
        branch4 = controldir.ControlDir.create_branch_convenience('checkout',
287
287
            format=knit1_format)
288
288
        branch4.bind(branch1)
289
 
        branch4.bzrdir.open_workingtree().update()
 
289
        branch4.controldir.open_workingtree().update()
290
290
        out, err = self.run_bzr('info checkout --verbose')
291
291
        self.assertEqualDiff(
292
292
"""Checkout (format: knit)
548
548
 
549
549
    def test_info_standalone_no_tree(self):
550
550
        # create standalone branch without a working tree
551
 
        format = controldir.format_registry.make_bzrdir('default')
 
551
        format = controldir.format_registry.make_controldir('default')
552
552
        branch = self.make_branch('branch')
553
553
        repo = branch.repository
554
554
        out, err = self.run_bzr('info branch -v')
570
570
 
571
571
Repository:
572
572
         0 revisions
573
 
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
 
573
""" % (info.describe_format(repo.controldir, repo, branch, None),
574
574
       format.get_branch_format().get_format_description(),
575
575
       format.repository_format.get_format_description(),
576
576
       ), out)
577
577
        self.assertEqual('', err)
578
578
 
579
579
    def test_info_shared_repository(self):
580
 
        format = controldir.format_registry.make_bzrdir('knit')
 
580
        format = controldir.format_registry.make_controldir('knit')
581
581
        transport = self.get_transport()
582
582
 
583
583
        # Create shared repository
603
603
        self.assertEqual('', err)
604
604
 
605
605
        # Create branch inside shared repository
606
 
        repo.bzrdir.root_transport.mkdir('branch')
 
606
        repo.controldir.root_transport.mkdir('branch')
607
607
        branch1 = controldir.ControlDir.create_branch_convenience(
608
608
            'repo/branch', format=format)
609
609
        out, err = self.run_bzr('info -v repo/branch')
873
873
        self.assertEqual('', err)
874
874
 
875
875
    def test_info_shared_repository_with_trees(self):
876
 
        format = controldir.format_registry.make_bzrdir('knit')
 
876
        format = controldir.format_registry.make_controldir('knit')
877
877
        transport = self.get_transport()
878
878
 
879
879
        # Create shared repository with working trees
901
901
        self.assertEqual('', err)
902
902
 
903
903
        # Create two branches
904
 
        repo.bzrdir.root_transport.mkdir('branch1')
 
904
        repo.controldir.root_transport.mkdir('branch1')
905
905
        branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
906
906
            format=format)
907
 
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
 
907
        branch2 = branch1.controldir.sprout('repo/branch2').open_branch()
908
908
 
909
909
        # Empty first branch
910
910
        out, err = self.run_bzr('info repo/branch1 --verbose')
945
945
 
946
946
        # Update first branch
947
947
        self.build_tree(['repo/branch1/a'])
948
 
        tree1 = branch1.bzrdir.open_workingtree()
 
948
        tree1 = branch1.controldir.open_workingtree()
949
949
        tree1.add('a')
950
950
        tree1.commit('commit one')
951
951
        rev = repo.get_revision(branch1.last_revision())
1031
1031
        self.assertEqual('', err)
1032
1032
 
1033
1033
        # Update second branch
1034
 
        tree2 = branch2.bzrdir.open_workingtree()
 
1034
        tree2 = branch2.controldir.open_workingtree()
1035
1035
        tree2.pull(branch1)
1036
1036
        out, err = self.run_bzr('info -v repo/branch2')
1037
1037
        self.assertEqualDiff(
1100
1100
        self.assertEqual('', err)
1101
1101
 
1102
1102
    def test_info_shared_repository_with_tree_in_root(self):
1103
 
        format = controldir.format_registry.make_bzrdir('knit')
 
1103
        format = controldir.format_registry.make_controldir('knit')
1104
1104
        transport = self.get_transport()
1105
1105
 
1106
1106
        # Create shared repository with working trees
1128
1128
        self.assertEqual('', err)
1129
1129
 
1130
1130
        # Create branch in root of repository
1131
 
        control = repo.bzrdir
 
1131
        control = repo.controldir
1132
1132
        branch = control.create_branch()
1133
1133
        control.create_workingtree()
1134
1134
        out, err = self.run_bzr('info -v repo')
1168
1168
        self.assertEqual('', err)
1169
1169
 
1170
1170
    def test_info_repository_hook(self):
1171
 
        format = controldir.format_registry.make_bzrdir('knit')
 
1171
        format = controldir.format_registry.make_controldir('knit')
1172
1172
        def repo_info(repo, stats, outf):
1173
1173
            outf.write("more info\n")
1174
1174
        info.hooks.install_named_hook('repository', repo_info, None)
1197
1197
        self.assertEqual('', err)
1198
1198
 
1199
1199
    def test_info_unshared_repository_with_colocated_branches(self):
1200
 
        format = controldir.format_registry.make_bzrdir('development-colo')
 
1200
        format = controldir.format_registry.make_controldir('development-colo')
1201
1201
        transport = self.get_transport()
1202
1202
 
1203
1203
        # Create unshared repository
1204
1204
        repo = self.make_repository('repo', shared=False, format=format)
1205
1205
        repo.set_make_working_trees(True)
1206
 
        repo.bzrdir.create_branch(name='foo')
 
1206
        repo.controldir.create_branch(name='foo')
1207
1207
        out, err = self.run_bzr('info repo')
1208
1208
        self.assertEqualDiff(
1209
1209
"""Unshared repository with trees and colocated branches (format: development-colo)
1291
1291
        extra_space = ''
1292
1292
        if light_checkout:
1293
1293
            tree_data = ("  light checkout root: %s\n" %
1294
 
                friendly_location(lco_tree.bzrdir.root_transport.base))
 
1294
                friendly_location(lco_tree.controldir.root_transport.base))
1295
1295
            extra_space = ' '
1296
1296
        if lco_tree.branch.get_bound_location() is not None:
1297
1297
            tree_data += ("%s       checkout root: %s\n" % (extra_space,
1298
 
                friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
 
1298
                friendly_location(lco_tree.branch.controldir.root_transport.base)))
1299
1299
        if shared_repo is not None:
1300
1300
            branch_data = (
1301
1301
                "   checkout of branch: %s\n"
1302
1302
                "    shared repository: %s\n" %
1303
 
                (friendly_location(repo_branch.bzrdir.root_transport.base),
1304
 
                 friendly_location(shared_repo.bzrdir.root_transport.base)))
 
1303
                (friendly_location(repo_branch.controldir.root_transport.base),
 
1304
                 friendly_location(shared_repo.controldir.root_transport.base)))
1305
1305
        elif repo_branch is not None:
1306
1306
            branch_data = (
1307
1307
                "%s  checkout of branch: %s\n" %
1308
1308
                (extra_space,
1309
 
                 friendly_location(repo_branch.bzrdir.root_transport.base)))
 
1309
                 friendly_location(repo_branch.controldir.root_transport.base)))
1310
1310
        else:
1311
1311
            branch_data = ("   checkout of branch: %s\n" %
1312
 
                lco_tree.branch.bzrdir.root_transport.base)
 
1312
                lco_tree.branch.controldir.root_transport.base)
1313
1313
 
1314
1314
        if verbose >= 2:
1315
1315
            verbose_info = '         0 committers\n'
1362
1362
        repo = self.make_repository('repo', shared=True,
1363
1363
                                    format=bzrdir.BzrDirMetaFormat1())
1364
1364
        repo.set_make_working_trees(False)
1365
 
        repo.bzrdir.root_transport.mkdir('branch')
 
1365
        repo.controldir.root_transport.mkdir('branch')
1366
1366
        repo_branch = controldir.ControlDir.create_branch_convenience(
1367
1367
            'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1368
1368
        # Do a heavy checkout
1474
1474
            format='1.6')
1475
1475
        trunk_tree.commit('mainline')
1476
1476
        # and a branch from it which is stacked
1477
 
        new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
 
1477
        new_dir = trunk_tree.controldir.sprout('newbranch', stacked=True)
1478
1478
        out, err = self.run_bzr('info newbranch')
1479
1479
        self.assertEqual(
1480
1480
"""Standalone tree (format: 1.6)
1521
1521
        self.assertEqual("", err)
1522
1522
 
1523
1523
    def test_info_shows_colocated_branches(self):
1524
 
        bzrdir = self.make_branch('.', format='development-colo').bzrdir
 
1524
        bzrdir = self.make_branch('.', format='development-colo').controldir
1525
1525
        bzrdir.create_branch(name="colo1")
1526
1526
        bzrdir.create_branch(name="colo2")
1527
1527
        bzrdir.create_branch(name="colo3")