48
45
self.assertEqual(out, '')
49
46
self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
51
def test_info_empty_controldir(self):
52
self.make_bzrdir('ctrl')
53
out, err = self.run_bzr('info ctrl')
54
self.assertEquals(out,
55
'Empty control directory (format: 2a or pack-0.92)\n'
57
' control directory: ctrl\n')
58
self.assertEquals(err, '')
60
def test_info_dangling_branch_reference(self):
61
br = self.make_branch('target')
62
br.create_checkout('from', lightweight=True)
63
shutil.rmtree('target')
64
out, err = self.run_bzr('info from')
65
self.assertEquals(out,
66
'Dangling branch reference (format: 2a or pack-0.92)\n'
68
' control directory: from\n'
69
' checkout of branch: target\n')
70
self.assertEquals(err, '')
72
48
def test_info_standalone(self):
73
49
transport = self.get_transport()
1182
1074
self.assertEqual('', err)
1184
def test_info_unshared_repository_with_colocated_branches(self):
1185
format = bzrdir.format_registry.make_bzrdir('development-colo')
1186
transport = self.get_transport()
1188
# Create unshared repository
1189
repo = self.make_repository('repo', shared=False, format=format)
1190
repo.set_make_working_trees(True)
1191
repo.bzrdir.create_branch(name='foo')
1192
out, err = self.run_bzr('info repo')
1193
self.assertEqualDiff(
1194
"""Unshared repository with trees and colocated branches (format: development-colo)
1198
self.assertEqual('', err)
1200
1076
def assertCheckoutStatusOutput(self,
1201
1077
command_string, lco_tree, shared_repo=None,
1202
1078
repo_branch=None,
1348
1221
format=bzrdir.BzrDirMetaFormat1())
1349
1222
repo.set_make_working_trees(False)
1350
1223
repo.bzrdir.root_transport.mkdir('branch')
1351
repo_branch = controldir.ControlDir.create_branch_convenience(
1352
'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1224
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1225
format=bzrdir.BzrDirMetaFormat1())
1353
1226
# Do a heavy checkout
1354
1227
transport.mkdir('tree')
1355
1228
transport.mkdir('tree/checkout')
1356
co_branch = controldir.ControlDir.create_branch_convenience(
1357
'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1229
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1230
format=bzrdir.BzrDirMetaFormat1())
1358
1231
co_branch.bind(repo_branch)
1359
1232
# Do a light checkout of the heavy one
1360
1233
transport.mkdir('tree/lightcheckout')
1361
1234
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1362
lco_dir.set_branch_reference(co_branch)
1235
branch.BranchReferenceFormat().initialize(lco_dir,
1236
target_branch=co_branch)
1363
1237
lco_dir.create_workingtree()
1364
1238
lco_tree = lco_dir.open_workingtree()
1471
1345
stacked on: mainline
1473
1347
self.assertEqual("", err)
1475
def test_info_revinfo_optional(self):
1476
tree = self.make_branch_and_tree('.')
1477
def last_revision_info(self):
1478
raise errors.UnsupportedOperation(last_revision_info, self)
1480
branch.Branch, "last_revision_info", last_revision_info)
1481
out, err = self.run_bzr('info -v .')
1483
"""Standalone tree (format: 2a)
1488
control: Meta directory format 1
1489
working tree: Working tree format 6
1490
branch: Branch format 7
1491
repository: Repository format 2a - rich roots, group compression and chk inventories
1496
In the working tree:
1504
0 versioned subdirectories
1506
self.assertEqual("", err)
1508
def test_info_shows_colocated_branches(self):
1509
bzrdir = self.make_branch('.', format='development-colo').bzrdir
1510
bzrdir.create_branch(name="colo1")
1511
bzrdir.create_branch(name="colo2")
1512
bzrdir.create_branch(name="colo3")
1513
out, err = self.run_bzr('info -v .')
1514
self.assertEqualDiff(
1515
"""Standalone branch (format: development-colo)
1520
control: Meta directory format 1 with support for colocated branches
1521
branch: Branch format 7
1522
repository: Repository format 2a - rich roots, group compression and chk inventories
1533
self.assertEqual("", err)
1536
class TestSmartServerInfo(tests.TestCaseWithTransport):
1538
def test_simple_branch_info(self):
1539
self.setup_smart_server_with_call_log()
1540
t = self.make_branch_and_tree('branch')
1541
self.build_tree_contents([('branch/foo', 'thecontents')])
1544
self.reset_smart_call_log()
1545
out, err = self.run_bzr(['info', self.get_url('branch')])
1546
# This figure represent the amount of work to perform this use case. It
1547
# is entirely ok to reduce this number if a test fails due to rpc_count
1548
# being too low. If rpc_count increases, more network roundtrips have
1549
# become necessary for this use case. Please do not adjust this number
1550
# upwards without agreement from bzr's network support maintainers.
1551
self.assertLength(12, self.hpss_calls)
1552
self.assertLength(1, self.hpss_connections)
1553
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1555
def test_verbose_branch_info(self):
1556
self.setup_smart_server_with_call_log()
1557
t = self.make_branch_and_tree('branch')
1558
self.build_tree_contents([('branch/foo', 'thecontents')])
1561
self.reset_smart_call_log()
1562
out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
1563
# This figure represent the amount of work to perform this use case. It
1564
# is entirely ok to reduce this number if a test fails due to rpc_count
1565
# being too low. If rpc_count increases, more network roundtrips have
1566
# become necessary for this use case. Please do not adjust this number
1567
# upwards without agreement from bzr's network support maintainers.
1568
self.assertLength(16, self.hpss_calls)
1569
self.assertLength(1, self.hpss_connections)
1570
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)