1
# Copyright (C) 2006-2012, 2016 Canonical Ltd
1
# Copyright (C) 2006-2010 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
51
51
def test_info_empty_controldir(self):
52
52
self.make_bzrdir('ctrl')
53
53
out, err = self.run_bzr('info ctrl')
54
self.assertEquals(out,
55
55
'Empty control directory (format: 2a or pack-0.92)\n'
57
57
' control directory: ctrl\n')
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, '')
58
self.assertEquals(err, '')
73
60
def test_info_dangling_branch_reference(self):
74
61
br = self.make_branch('target')
75
62
br.create_checkout('from', lightweight=True)
76
63
shutil.rmtree('target')
77
64
out, err = self.run_bzr('info from')
65
self.assertEquals(out,
79
66
'Dangling branch reference (format: 2a or pack-0.92)\n'
81
68
' control directory: from\n'
82
69
' checkout of branch: target\n')
83
self.assertEqual(err, '')
70
self.assertEquals(err, '')
85
72
def test_info_standalone(self):
86
73
transport = self.get_transport()
231
218
# Branch and bind to standalone, needs upgrade to metadir
232
219
# (creates backup as unknown)
233
220
branch1.bzrdir.sprout('bound')
234
knit1_format = controldir.format_registry.make_bzrdir('knit')
221
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
235
222
upgrade.upgrade('bound', knit1_format)
236
223
branch3 = controldir.ControlDir.open('bound').open_branch()
237
224
branch3.bind(branch1)
328
315
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
329
316
branch5 = tree5.branch
330
317
out, err = self.run_bzr('info -v lightcheckout')
331
if "metaweave" in controldir.format_registry:
318
if "metaweave" in bzrdir.format_registry:
332
319
format_description = "knit or metaweave"
334
321
format_description = "knit"
547
534
def test_info_standalone_no_tree(self):
548
535
# create standalone branch without a working tree
549
format = controldir.format_registry.make_bzrdir('default')
536
format = bzrdir.format_registry.make_bzrdir('default')
550
537
branch = self.make_branch('branch')
551
538
repo = branch.repository
552
539
out, err = self.run_bzr('info branch -v')
575
562
self.assertEqual('', err)
577
564
def test_info_shared_repository(self):
578
format = controldir.format_registry.make_bzrdir('knit')
565
format = bzrdir.format_registry.make_bzrdir('knit')
579
566
transport = self.get_transport()
581
568
# Create shared repository
871
858
self.assertEqual('', err)
873
860
def test_info_shared_repository_with_trees(self):
874
format = controldir.format_registry.make_bzrdir('knit')
861
format = bzrdir.format_registry.make_bzrdir('knit')
875
862
transport = self.get_transport()
877
864
# Create shared repository with working trees
1098
1085
self.assertEqual('', err)
1100
1087
def test_info_shared_repository_with_tree_in_root(self):
1101
format = controldir.format_registry.make_bzrdir('knit')
1088
format = bzrdir.format_registry.make_bzrdir('knit')
1102
1089
transport = self.get_transport()
1104
1091
# Create shared repository with working trees
1166
1153
self.assertEqual('', err)
1168
1155
def test_info_repository_hook(self):
1169
format = controldir.format_registry.make_bzrdir('knit')
1156
format = bzrdir.format_registry.make_bzrdir('knit')
1170
1157
def repo_info(repo, stats, outf):
1171
1158
outf.write("more info\n")
1172
1159
info.hooks.install_named_hook('repository', repo_info, None)
1195
1182
self.assertEqual('', err)
1197
1184
def test_info_unshared_repository_with_colocated_branches(self):
1198
format = controldir.format_registry.make_bzrdir('development-colo')
1185
format = bzrdir.format_registry.make_bzrdir('development-colo')
1199
1186
transport = self.get_transport()
1201
1188
# Create unshared repository
1561
1548
# being too low. If rpc_count increases, more network roundtrips have
1562
1549
# become necessary for this use case. Please do not adjust this number
1563
1550
# upwards without agreement from bzr's network support maintainers.
1564
self.assertLength(10, self.hpss_calls)
1551
self.assertLength(12, self.hpss_calls)
1565
1552
self.assertLength(1, self.hpss_connections)
1566
1553
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1578
1565
# being too low. If rpc_count increases, more network roundtrips have
1579
1566
# become necessary for this use case. Please do not adjust this number
1580
1567
# upwards without agreement from bzr's network support maintainers.
1581
self.assertLength(14, self.hpss_calls)
1568
self.assertLength(16, self.hpss_calls)
1582
1569
self.assertLength(1, self.hpss_connections)
1583
1570
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)