45
48
self.assertEqual(out, '')
46
49
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, '')
48
72
def test_info_standalone(self):
49
73
transport = self.get_transport()
1221
1245
format=bzrdir.BzrDirMetaFormat1())
1222
1246
repo.set_make_working_trees(False)
1223
1247
repo.bzrdir.root_transport.mkdir('branch')
1224
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1225
format=bzrdir.BzrDirMetaFormat1())
1248
repo_branch = controldir.ControlDir.create_branch_convenience(
1249
'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1226
1250
# Do a heavy checkout
1227
1251
transport.mkdir('tree')
1228
1252
transport.mkdir('tree/checkout')
1229
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1230
format=bzrdir.BzrDirMetaFormat1())
1253
co_branch = controldir.ControlDir.create_branch_convenience(
1254
'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1231
1255
co_branch.bind(repo_branch)
1232
1256
# Do a light checkout of the heavy one
1233
1257
transport.mkdir('tree/lightcheckout')
1345
1369
stacked on: mainline
1347
1371
self.assertEqual("", err)
1373
def test_info_revinfo_optional(self):
1374
tree = self.make_branch_and_tree('.')
1375
def last_revision_info(self):
1376
raise errors.UnsupportedOperation(last_revision_info, self)
1378
branch.Branch, "last_revision_info", last_revision_info)
1379
out, err = self.run_bzr('info -v .')
1381
"""Standalone tree (format: 2a)
1386
control: Meta directory format 1
1387
working tree: Working tree format 6
1388
branch: Branch format 7
1389
repository: Repository format 2a - rich roots, group compression and chk inventories
1391
In the working tree:
1399
0 versioned subdirectories
1401
self.assertEqual("", err)
1403
def test_info_shows_colocated_branches(self):
1404
bzrdir = self.make_branch('.', format='development-colo').bzrdir
1405
bzrdir.create_branch(name="colo1")
1406
bzrdir.create_branch(name="colo2")
1407
bzrdir.create_branch(name="colo3")
1408
out, err = self.run_bzr('info -v .')
1409
self.assertEqualDiff(
1410
"""Standalone branch (format: development-colo)
1415
control: Meta directory format 1 with support for colocated branches
1416
branch: Branch format 7
1417
repository: Repository format 2a - rich roots, group compression and chk inventories
1428
self.assertEqual("", err)
1431
class TestSmartServerInfo(tests.TestCaseWithTransport):
1433
def test_simple_branch_info(self):
1434
self.setup_smart_server_with_call_log()
1435
t = self.make_branch_and_tree('branch')
1436
self.build_tree_contents([('branch/foo', 'thecontents')])
1439
self.reset_smart_call_log()
1440
out, err = self.run_bzr(['info', self.get_url('branch')])
1441
# This figure represent the amount of work to perform this use case. It
1442
# is entirely ok to reduce this number if a test fails due to rpc_count
1443
# being too low. If rpc_count increases, more network roundtrips have
1444
# become necessary for this use case. Please do not adjust this number
1445
# upwards without agreement from bzr's network support maintainers.
1446
self.assertLength(12, self.hpss_calls)
1447
self.assertLength(1, self.hpss_connections)
1448
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1450
def test_verbose_branch_info(self):
1451
self.setup_smart_server_with_call_log()
1452
t = self.make_branch_and_tree('branch')
1453
self.build_tree_contents([('branch/foo', 'thecontents')])
1456
self.reset_smart_call_log()
1457
out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
1458
# This figure represent the amount of work to perform this use case. It
1459
# is entirely ok to reduce this number if a test fails due to rpc_count
1460
# being too low. If rpc_count increases, more network roundtrips have
1461
# become necessary for this use case. Please do not adjust this number
1462
# upwards without agreement from bzr's network support maintainers.
1463
self.assertLength(16, self.hpss_calls)
1464
self.assertLength(1, self.hpss_connections)
1465
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)