1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
50
51
def test_info_empty_controldir(self):
51
52
self.make_bzrdir('ctrl')
52
53
out, err = self.run_bzr('info ctrl')
53
self.assertEquals(out,
54
55
'Empty control directory (format: 2a or pack-0.92)\n'
56
57
' control directory: ctrl\n')
57
self.assertEquals(err, '')
58
self.assertEqual(err, '')
60
def test_info_empty_controldir_verbose(self):
61
self.make_bzrdir('ctrl')
62
out, err = self.run_bzr('info -v ctrl')
63
self.assertEqualDiff(out,
64
'Empty control directory (format: 2a or pack-0.92)\n'
66
' control directory: ctrl\n\n'
68
' control: Meta directory format 1\n\n'
69
'Control directory:\n'
71
self.assertEqual(err, '')
59
73
def test_info_dangling_branch_reference(self):
60
74
br = self.make_branch('target')
61
75
br.create_checkout('from', lightweight=True)
62
76
shutil.rmtree('target')
63
77
out, err = self.run_bzr('info from')
64
self.assertEquals(out,
65
79
'Dangling branch reference (format: 2a or pack-0.92)\n'
67
81
' control directory: from\n'
68
82
' checkout of branch: target\n')
69
self.assertEquals(err, '')
83
self.assertEqual(err, '')
71
85
def test_info_standalone(self):
72
86
transport = self.get_transport()
208
231
# Branch and bind to standalone, needs upgrade to metadir
209
232
# (creates backup as unknown)
210
233
branch1.bzrdir.sprout('bound')
211
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
234
knit1_format = controldir.format_registry.make_bzrdir('knit')
212
235
upgrade.upgrade('bound', knit1_format)
213
236
branch3 = controldir.ControlDir.open('bound').open_branch()
214
237
branch3.bind(branch1)
299
328
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
300
329
branch5 = tree5.branch
301
330
out, err = self.run_bzr('info -v lightcheckout')
302
if "metaweave" in bzrdir.format_registry:
331
if "metaweave" in controldir.format_registry:
303
332
format_description = "knit or metaweave"
305
334
format_description = "knit"
503
547
def test_info_standalone_no_tree(self):
504
548
# create standalone branch without a working tree
505
format = bzrdir.format_registry.make_bzrdir('default')
549
format = controldir.format_registry.make_bzrdir('default')
506
550
branch = self.make_branch('branch')
507
551
repo = branch.repository
508
552
out, err = self.run_bzr('info branch -v')
528
575
self.assertEqual('', err)
530
577
def test_info_shared_repository(self):
531
format = bzrdir.format_registry.make_bzrdir('knit')
578
format = controldir.format_registry.make_bzrdir('knit')
532
579
transport = self.get_transport()
534
581
# Create shared repository
800
871
self.assertEqual('', err)
802
873
def test_info_shared_repository_with_trees(self):
803
format = bzrdir.format_registry.make_bzrdir('knit')
874
format = controldir.format_registry.make_bzrdir('knit')
804
875
transport = self.get_transport()
806
877
# Create shared repository with working trees
1009
1098
self.assertEqual('', err)
1011
1100
def test_info_shared_repository_with_tree_in_root(self):
1012
format = bzrdir.format_registry.make_bzrdir('knit')
1101
format = controldir.format_registry.make_bzrdir('knit')
1013
1102
transport = self.get_transport()
1015
1104
# Create shared repository with working trees
1071
1166
self.assertEqual('', err)
1073
1168
def test_info_repository_hook(self):
1074
format = bzrdir.format_registry.make_bzrdir('knit')
1169
format = controldir.format_registry.make_bzrdir('knit')
1075
1170
def repo_info(repo, stats, outf):
1076
1171
outf.write("more info\n")
1077
1172
info.hooks.install_named_hook('repository', repo_info, None)
1097
1195
self.assertEqual('', err)
1197
def test_info_unshared_repository_with_colocated_branches(self):
1198
format = controldir.format_registry.make_bzrdir('development-colo')
1199
transport = self.get_transport()
1201
# Create unshared repository
1202
repo = self.make_repository('repo', shared=False, format=format)
1203
repo.set_make_working_trees(True)
1204
repo.bzrdir.create_branch(name='foo')
1205
out, err = self.run_bzr('info repo')
1206
self.assertEqualDiff(
1207
"""Unshared repository with trees and colocated branches (format: development-colo)
1211
self.assertEqual('', err)
1099
1213
def assertCheckoutStatusOutput(self,
1100
1214
command_string, lco_tree, shared_repo=None,
1101
1215
repo_branch=None,
1255
1372
# Do a light checkout of the heavy one
1256
1373
transport.mkdir('tree/lightcheckout')
1257
1374
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1258
branch.BranchReferenceFormat().initialize(lco_dir,
1259
target_branch=co_branch)
1375
lco_dir.set_branch_reference(co_branch)
1260
1376
lco_dir.create_workingtree()
1261
1377
lco_tree = lco_dir.open_workingtree()
1442
1561
# being too low. If rpc_count increases, more network roundtrips have
1443
1562
# become necessary for this use case. Please do not adjust this number
1444
1563
# upwards without agreement from bzr's network support maintainers.
1445
self.assertLength(12, self.hpss_calls)
1564
self.assertLength(10, self.hpss_calls)
1565
self.assertLength(1, self.hpss_connections)
1566
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1447
1568
def test_verbose_branch_info(self):
1448
1569
self.setup_smart_server_with_call_log()
1457
1578
# being too low. If rpc_count increases, more network roundtrips have
1458
1579
# become necessary for this use case. Please do not adjust this number
1459
1580
# upwards without agreement from bzr's network support maintainers.
1460
self.assertLength(16, self.hpss_calls)
1581
self.assertLength(14, self.hpss_calls)
1582
self.assertLength(1, self.hpss_connections)
1583
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)