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()
51
75
# Create initial standalone branch
52
tree1 = self.make_branch_and_tree('standalone', 'weave')
76
tree1 = self.make_branch_and_tree('standalone', 'knit')
53
77
self.build_tree(['standalone/a'])
55
79
branch1 = tree1.branch
57
81
out, err = self.run_bzr('info standalone')
58
82
self.assertEqualDiff(
59
"""Standalone tree (format: weave)
83
"""Standalone tree (format: knit)
61
85
branch root: standalone
65
89
# Standalone branch - verbose mode
66
90
out, err = self.run_bzr('info standalone -v')
67
91
self.assertEqualDiff(
68
"""Standalone tree (format: weave)
92
"""Standalone tree (format: knit)
70
94
branch root: standalone
73
control: All-in-one format 6
74
working tree: Working tree format 2
75
branch: Branch format 4
76
repository: Weave repository format 6
97
control: Meta directory format 1
98
working tree: Working tree format 3
99
branch: Branch format 5
100
repository: Knit repository format 1
78
102
In the working tree:
96
120
# Standalone branch - really verbose mode
97
121
out, err = self.run_bzr('info standalone -vv')
98
122
self.assertEqualDiff(
99
"""Standalone tree (format: weave)
123
"""Standalone tree (format: knit)
101
125
branch root: standalone
104
control: All-in-one format 6
105
working tree: Working tree format 2
106
branch: Branch format 4
107
repository: Weave repository format 6
128
control: Meta directory format 1
129
working tree: Working tree format 3
130
branch: Branch format 5
131
repository: Knit repository format 1
109
133
In the working tree:
309
""" % (self._repo_strings, datestring_first, datestring_first,), out)
337
""" % (format_description, datestring_first, datestring_first,), out)
310
338
self.assertEqual('', err)
312
340
# Update initial standalone branch
313
341
self.build_tree(['standalone/b'])
315
343
tree1.commit('commit two')
316
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
344
rev = branch1.repository.get_revision(branch1.last_revision())
317
345
datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
319
347
# Out of date branched standalone branch will not be detected
320
348
out, err = self.run_bzr('info -v branch')
321
349
self.assertEqualDiff(
322
"""Standalone tree (format: weave)
350
"""Standalone tree (format: knit)
324
352
branch root: branch
1070
1098
self.assertEqual('', err)
1100
def test_info_unshared_repository_with_colocated_branches(self):
1101
format = bzrdir.format_registry.make_bzrdir('development-colo')
1102
transport = self.get_transport()
1104
# Create unshared repository
1105
repo = self.make_repository('repo', shared=False, format=format)
1106
repo.set_make_working_trees(True)
1107
repo.bzrdir.create_branch(name='foo')
1108
out, err = self.run_bzr('info repo')
1109
self.assertEqualDiff(
1110
"""Unshared repository with trees and colocated branches (format: development-colo)
1114
self.assertEqual('', err)
1072
1116
def assertCheckoutStatusOutput(self,
1073
1117
command_string, lco_tree, shared_repo=None,
1074
1118
repo_branch=None,
1217
1261
format=bzrdir.BzrDirMetaFormat1())
1218
1262
repo.set_make_working_trees(False)
1219
1263
repo.bzrdir.root_transport.mkdir('branch')
1220
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
format=bzrdir.BzrDirMetaFormat1())
1264
repo_branch = controldir.ControlDir.create_branch_convenience(
1265
'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1222
1266
# Do a heavy checkout
1223
1267
transport.mkdir('tree')
1224
1268
transport.mkdir('tree/checkout')
1225
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
format=bzrdir.BzrDirMetaFormat1())
1269
co_branch = controldir.ControlDir.create_branch_convenience(
1270
'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1227
1271
co_branch.bind(repo_branch)
1228
1272
# Do a light checkout of the heavy one
1229
1273
transport.mkdir('tree/lightcheckout')
1230
1274
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
branch.BranchReferenceFormat().initialize(lco_dir,
1232
target_branch=co_branch)
1275
lco_dir.set_branch_reference(co_branch)
1233
1276
lco_dir.create_workingtree()
1234
1277
lco_tree = lco_dir.open_workingtree()
1323
1366
self.knownFailure('Win32 cannot run "bzr info"'
1324
1367
' when the tree is locked.')
1326
def test_info_locking_oslocks(self):
1327
if sys.platform == "win32":
1328
self.skip("don't use oslocks on win32 in unix manner")
1329
# This test tests old (all-in-one, OS lock using) behaviour which
1330
# simply cannot work on windows (and is indeed why we changed our
1331
# design. As such, don't try to remove the thisFailsStrictLockCheck
1333
self.thisFailsStrictLockCheck()
1335
tree = self.make_branch_and_tree('branch',
1336
format=bzrdir.BzrDirFormat6())
1338
# Test all permutations of locking the working tree, branch and repository
1339
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1340
# implemented by raising NotImplementedError and get_physical_lock_status()
1341
# always returns false. This makes bzr info hide the lock status. (Olaf)
1345
out, err = self.run_bzr('info -v branch')
1346
self.assertEqualDiff(
1347
"""Standalone tree (format: weave)
1352
control: All-in-one format 6
1353
working tree: Working tree format 2
1354
branch: Branch format 4
1357
In the working tree:
1365
0 versioned subdirectories
1372
""" % ('branch', tree.branch.repository._format.get_format_description(),
1374
self.assertEqual('', err)
1377
out, err = self.run_bzr('info -v branch')
1378
self.assertEqualDiff(
1379
"""Standalone tree (format: weave)
1384
control: All-in-one format 6
1385
working tree: Working tree format 2
1386
branch: Branch format 4
1389
In the working tree:
1397
0 versioned subdirectories
1404
""" % ('branch', tree.branch.repository._format.get_format_description(),
1406
self.assertEqual('', err)
1409
1369
def test_info_stacked(self):
1410
1370
# We have a mainline
1411
1371
trunk_tree = self.make_branch_and_tree('mainline',
1424
1384
stacked on: mainline
1426
1386
self.assertEqual("", err)
1388
def test_info_revinfo_optional(self):
1389
tree = self.make_branch_and_tree('.')
1390
def last_revision_info(self):
1391
raise errors.UnsupportedOperation(last_revision_info, self)
1393
branch.Branch, "last_revision_info", last_revision_info)
1394
out, err = self.run_bzr('info -v .')
1396
"""Standalone tree (format: 2a)
1401
control: Meta directory format 1
1402
working tree: Working tree format 6
1403
branch: Branch format 7
1404
repository: Repository format 2a - rich roots, group compression and chk inventories
1406
In the working tree:
1414
0 versioned subdirectories
1416
self.assertEqual("", err)
1418
def test_info_shows_colocated_branches(self):
1419
bzrdir = self.make_branch('.', format='development-colo').bzrdir
1420
bzrdir.create_branch(name="colo1")
1421
bzrdir.create_branch(name="colo2")
1422
bzrdir.create_branch(name="colo3")
1423
out, err = self.run_bzr('info -v .')
1424
self.assertEqualDiff(
1425
"""Standalone branch (format: development-colo)
1430
control: Meta directory format 1 with support for colocated branches
1431
branch: Branch format 7
1432
repository: Repository format 2a - rich roots, group compression and chk inventories
1443
self.assertEqual("", err)
1446
class TestSmartServerInfo(tests.TestCaseWithTransport):
1448
def test_simple_branch_info(self):
1449
self.setup_smart_server_with_call_log()
1450
t = self.make_branch_and_tree('branch')
1451
self.build_tree_contents([('branch/foo', 'thecontents')])
1454
self.reset_smart_call_log()
1455
out, err = self.run_bzr(['info', self.get_url('branch')])
1456
# This figure represent the amount of work to perform this use case. It
1457
# is entirely ok to reduce this number if a test fails due to rpc_count
1458
# being too low. If rpc_count increases, more network roundtrips have
1459
# become necessary for this use case. Please do not adjust this number
1460
# upwards without agreement from bzr's network support maintainers.
1461
self.assertLength(12, self.hpss_calls)
1462
self.assertLength(1, self.hpss_connections)
1463
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1465
def test_verbose_branch_info(self):
1466
self.setup_smart_server_with_call_log()
1467
t = self.make_branch_and_tree('branch')
1468
self.build_tree_contents([('branch/foo', 'thecontents')])
1471
self.reset_smart_call_log()
1472
out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
1473
# This figure represent the amount of work to perform this use case. It
1474
# is entirely ok to reduce this number if a test fails due to rpc_count
1475
# being too low. If rpc_count increases, more network roundtrips have
1476
# become necessary for this use case. Please do not adjust this number
1477
# upwards without agreement from bzr's network support maintainers.
1478
self.assertLength(16, self.hpss_calls)
1479
self.assertLength(1, self.hpss_connections)
1480
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)