1032
1058
self.assertEqual('', err)
1034
1060
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1062
def test_info_shared_repository_with_tree_in_root(self):
1063
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
1064
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
1065
transport = self.get_transport()
1067
# Create shared repository with working trees
1068
repo = self.make_repository('repo', shared=True)
1069
repo.set_make_working_trees(True)
1070
out, err = self.runbzr('info repo')
1071
self.assertEqualDiff(
1073
shared repository: %s
1076
control: Meta directory format 1
1079
Create working tree for new branches inside the repository.
1084
""" % (repo.bzrdir.root_transport.base,
1085
repo._format.get_format_description(),
1087
self.assertEqual('', err)
1089
# Create branch in root of repository
1090
control = repo.bzrdir
1091
branch = control.create_branch()
1092
control.create_workingtree()
1093
out, err = self.runbzr('info repo')
1094
self.assertEqualDiff(
1096
shared repository: %s
1097
repository checkout: .
1100
control: Meta directory format 1
1101
working tree: Working tree format 3
1102
branch: Branch format 5
1105
In the working tree:
1113
0 versioned subdirectories
1121
""" % (repo.bzrdir.root_transport.base,
1122
repo._format.get_format_description(),
1124
self.assertEqual('', err)
1126
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1128
def test_info_locking(self):
1129
transport = self.get_transport()
1130
# Create shared repository with a branch
1131
repo = self.make_repository('repo', shared=True,
1132
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1133
repo.set_make_working_trees(False)
1134
repo.bzrdir.root_transport.mkdir('branch')
1135
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1136
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1137
# Do a heavy checkout
1138
transport.mkdir('tree')
1139
transport.mkdir('tree/checkout')
1140
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1141
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1142
co_branch.bind(repo_branch)
1143
# Do a light checkout of the heavy one
1144
transport.mkdir('tree/lightcheckout')
1145
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1146
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1147
lco_dir.create_workingtree()
1148
lco_tree = lco_dir.open_workingtree()
1150
# Test all permutations of locking the working tree, branch and repository
1154
out, err = self.runbzr('info tree/lightcheckout')
1155
self.assertEqualDiff(
1157
light checkout root: %s
1158
checkout of branch: %s
1161
control: Meta directory format 1
1162
working tree: Working tree format 3
1163
branch: Branch format 5
1166
In the working tree:
1174
0 versioned subdirectories
1182
""" % (lco_tree.bzrdir.root_transport.base,
1183
lco_tree.branch.bzrdir.root_transport.base,
1184
lco_tree.branch.repository._format.get_format_description(),
1186
self.assertEqual('', err)
1188
lco_tree.branch.repository.lock_write()
1189
out, err = self.runbzr('info tree/lightcheckout')
1190
self.assertEqualDiff(
1192
light checkout root: %s
1193
checkout of branch: %s
1196
control: Meta directory format 1
1197
working tree: Working tree format 3
1198
branch: Branch format 5
1202
working tree: unlocked
1206
In the working tree:
1214
0 versioned subdirectories
1222
""" % (lco_tree.bzrdir.root_transport.base,
1223
lco_tree.branch.bzrdir.root_transport.base,
1224
lco_tree.branch.repository._format.get_format_description(),
1226
self.assertEqual('', err)
1227
lco_tree.branch.repository.unlock()
1229
lco_tree.branch.lock_write()
1230
out, err = self.runbzr('info tree/lightcheckout')
1231
self.assertEqualDiff(
1233
light checkout root: %s
1234
checkout of branch: %s
1237
control: Meta directory format 1
1238
working tree: Working tree format 3
1239
branch: Branch format 5
1243
working tree: unlocked
1247
In the working tree:
1255
0 versioned subdirectories
1263
""" % (lco_tree.bzrdir.root_transport.base,
1264
lco_tree.branch.bzrdir.root_transport.base,
1265
lco_tree.branch.repository._format.get_format_description(),
1267
self.assertEqual('', err)
1268
lco_tree.branch.unlock()
1270
lco_tree.lock_write()
1271
out, err = self.runbzr('info tree/lightcheckout')
1272
self.assertEqualDiff(
1274
light checkout root: %s
1275
checkout of branch: %s
1278
control: Meta directory format 1
1279
working tree: Working tree format 3
1280
branch: Branch format 5
1284
working tree: locked
1288
In the working tree:
1296
0 versioned subdirectories
1304
""" % (lco_tree.bzrdir.root_transport.base,
1305
lco_tree.branch.bzrdir.root_transport.base,
1306
lco_tree.branch.repository._format.get_format_description(),
1308
self.assertEqual('', err)
1311
lco_tree.lock_write()
1312
lco_tree.branch.repository.unlock()
1313
out, err = self.runbzr('info tree/lightcheckout')
1314
self.assertEqualDiff(
1316
light checkout root: %s
1317
checkout of branch: %s
1320
control: Meta directory format 1
1321
working tree: Working tree format 3
1322
branch: Branch format 5
1326
working tree: locked
1328
repository: unlocked
1330
In the working tree:
1338
0 versioned subdirectories
1346
""" % (lco_tree.bzrdir.root_transport.base,
1347
lco_tree.branch.bzrdir.root_transport.base,
1348
lco_tree.branch.repository._format.get_format_description(),
1350
self.assertEqual('', err)
1351
lco_tree.branch.repository.lock_write()
1354
lco_tree.lock_write()
1355
lco_tree.branch.unlock()
1356
out, err = self.runbzr('info tree/lightcheckout')
1357
self.assertEqualDiff(
1359
light checkout root: %s
1360
checkout of branch: %s
1363
control: Meta directory format 1
1364
working tree: Working tree format 3
1365
branch: Branch format 5
1369
working tree: locked
1371
repository: unlocked
1373
In the working tree:
1381
0 versioned subdirectories
1389
""" % (lco_tree.bzrdir.root_transport.base,
1390
lco_tree.branch.bzrdir.root_transport.base,
1391
lco_tree.branch.repository._format.get_format_description(),
1393
self.assertEqual('', err)
1394
lco_tree.branch.lock_write()
1397
lco_tree.lock_write()
1398
lco_tree.branch.unlock()
1399
lco_tree.branch.repository.lock_write()
1400
out, err = self.runbzr('info tree/lightcheckout')
1401
self.assertEqualDiff(
1403
light checkout root: %s
1404
checkout of branch: %s
1407
control: Meta directory format 1
1408
working tree: Working tree format 3
1409
branch: Branch format 5
1413
working tree: locked
1417
In the working tree:
1425
0 versioned subdirectories
1433
""" % (lco_tree.bzrdir.root_transport.base,
1434
lco_tree.branch.bzrdir.root_transport.base,
1435
lco_tree.branch.repository._format.get_format_description(),
1437
self.assertEqual('', err)
1438
lco_tree.branch.repository.unlock()
1439
lco_tree.branch.lock_write()
1442
lco_tree.branch.lock_write()
1443
lco_tree.branch.repository.unlock()
1444
out, err = self.runbzr('info tree/lightcheckout')
1445
self.assertEqualDiff(
1447
light checkout root: %s
1448
checkout of branch: %s
1451
control: Meta directory format 1
1452
working tree: Working tree format 3
1453
branch: Branch format 5
1457
working tree: unlocked
1459
repository: unlocked
1461
In the working tree:
1469
0 versioned subdirectories
1477
""" % (lco_tree.bzrdir.root_transport.base,
1478
lco_tree.branch.bzrdir.root_transport.base,
1479
lco_tree.branch.repository._format.get_format_description(),
1481
self.assertEqual('', err)
1482
lco_tree.branch.repository.lock_write()
1483
lco_tree.branch.unlock()
1485
def test_info_locking_oslocks(self):
1486
tree = self.make_branch_and_tree('branch',
1487
format=bzrlib.bzrdir.BzrDirFormat6())
1489
# Test all permutations of locking the working tree, branch and repository
1490
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1491
# implemented by raising NotImplementedError and get_physical_lock_status()
1492
# always returns false. This makes bzr info hide the lock status. (Olaf)
1496
out, err = self.runbzr('info branch')
1497
self.assertEqualDiff(
1502
control: All-in-one format 6
1503
working tree: Working tree format 2
1504
branch: Branch format 4
1507
In the working tree:
1515
0 versioned subdirectories
1523
""" % (tree.bzrdir.root_transport.base,
1524
tree.branch.repository._format.get_format_description(),
1526
self.assertEqual('', err)
1529
out, err = self.runbzr('info branch')
1530
self.assertEqualDiff(
1535
control: All-in-one format 6
1536
working tree: Working tree format 2
1537
branch: Branch format 4
1540
In the working tree:
1548
0 versioned subdirectories
1556
""" % (tree.bzrdir.root_transport.base,
1557
tree.branch.repository._format.get_format_description(),
1559
self.assertEqual('', err)