112
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
113
branch1.bzrdir.root_transport.base,
114
datestring_first, datestring_first), out)
119
""" % (branch2.bzrdir.root_transport.base,
120
branch1.bzrdir.root_transport.base,
121
branch1.bzrdir.root_transport.base,
122
datestring_first, datestring_first,
123
# poking at _revision_store isn't all that clean, but neither is
124
# having the ui test dependent on the exact overhead of a given store.
125
branch2.repository._revision_store.total_size(
126
branch2.repository.get_transaction())[1] / 1024,
115
128
self.assertEqual('', err)
117
130
# Branch and bind to standalone, needs upgrade to metadir
118
131
# (creates backup as unknown)
119
# XXX: I can't get this to work through API
120
self.runbzr('branch standalone bound')
121
#branch3 = branch1.bzrdir.sprout('bound').open_branch()
122
self.runbzr('upgrade --format=metadir bound')
123
#bzrlib.upgrade.upgrade('bound', 'metadir')
132
branch3 = branch1.bzrdir.sprout('bound').open_branch()
133
bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
124
134
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
125
135
branch3.bind(branch1)
126
136
out, err = self.runbzr('info bound')
127
137
self.assertEqualDiff(
140
checkout of branch: %s
134
146
control: Meta directory format 1
1032
1055
self.assertEqual('', err)
1034
1057
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1059
def test_info_shared_repository_with_tree_in_root(self):
1060
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
1061
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
1062
transport = self.get_transport()
1064
# Create shared repository with working trees
1065
repo = self.make_repository('repo', shared=True)
1066
repo.set_make_working_trees(True)
1067
out, err = self.runbzr('info repo')
1068
self.assertEqualDiff(
1070
shared repository: %s
1073
control: Meta directory format 1
1076
Create working tree for new branches inside the repository.
1081
""" % (repo.bzrdir.root_transport.base,
1082
repo._format.get_format_description(),
1084
self.assertEqual('', err)
1086
# Create branch in root of repository
1087
control = repo.bzrdir
1088
branch = control.create_branch()
1089
control.create_workingtree()
1090
out, err = self.runbzr('info repo')
1091
self.assertEqualDiff(
1093
shared repository: %s
1094
repository checkout: .
1097
control: Meta directory format 1
1098
working tree: Working tree format 3
1099
branch: Branch format 5
1102
In the working tree:
1110
0 versioned subdirectories
1118
""" % (repo.bzrdir.root_transport.base,
1119
repo._format.get_format_description(),
1121
self.assertEqual('', err)
1123
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1125
def test_info_locking(self):
1126
transport = self.get_transport()
1127
# Create shared repository with a branch
1128
repo = self.make_repository('repo', shared=True,
1129
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1130
repo.set_make_working_trees(False)
1131
repo.bzrdir.root_transport.mkdir('branch')
1132
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1133
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1134
# Do a heavy checkout
1135
transport.mkdir('tree')
1136
transport.mkdir('tree/checkout')
1137
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1138
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1139
co_branch.bind(repo_branch)
1140
# Do a light checkout of the heavy one
1141
transport.mkdir('tree/lightcheckout')
1142
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1143
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1144
lco_dir.create_workingtree()
1145
lco_tree = lco_dir.open_workingtree()
1147
# Test all permutations of locking the working tree, branch and repository
1151
out, err = self.runbzr('info tree/lightcheckout')
1152
self.assertEqualDiff(
1154
light checkout root: %s
1155
checkout of branch: %s
1158
control: Meta directory format 1
1159
working tree: Working tree format 3
1160
branch: Branch format 5
1163
In the working tree:
1171
0 versioned subdirectories
1179
""" % (lco_tree.bzrdir.root_transport.base,
1180
lco_tree.branch.bzrdir.root_transport.base,
1181
lco_tree.branch.repository._format.get_format_description(),
1183
self.assertEqual('', err)
1185
lco_tree.branch.repository.lock_write()
1186
out, err = self.runbzr('info tree/lightcheckout')
1187
self.assertEqualDiff(
1189
light checkout root: %s
1190
checkout of branch: %s
1193
control: Meta directory format 1
1194
working tree: Working tree format 3
1195
branch: Branch format 5
1199
working tree: unlocked
1203
In the working tree:
1211
0 versioned subdirectories
1219
""" % (lco_tree.bzrdir.root_transport.base,
1220
lco_tree.branch.bzrdir.root_transport.base,
1221
lco_tree.branch.repository._format.get_format_description(),
1223
self.assertEqual('', err)
1224
lco_tree.branch.repository.unlock()
1226
lco_tree.branch.lock_write()
1227
out, err = self.runbzr('info tree/lightcheckout')
1228
self.assertEqualDiff(
1230
light checkout root: %s
1231
checkout of branch: %s
1234
control: Meta directory format 1
1235
working tree: Working tree format 3
1236
branch: Branch format 5
1240
working tree: unlocked
1244
In the working tree:
1252
0 versioned subdirectories
1260
""" % (lco_tree.bzrdir.root_transport.base,
1261
lco_tree.branch.bzrdir.root_transport.base,
1262
lco_tree.branch.repository._format.get_format_description(),
1264
self.assertEqual('', err)
1265
lco_tree.branch.unlock()
1267
lco_tree.lock_write()
1268
out, err = self.runbzr('info tree/lightcheckout')
1269
self.assertEqualDiff(
1271
light checkout root: %s
1272
checkout of branch: %s
1275
control: Meta directory format 1
1276
working tree: Working tree format 3
1277
branch: Branch format 5
1281
working tree: locked
1285
In the working tree:
1293
0 versioned subdirectories
1301
""" % (lco_tree.bzrdir.root_transport.base,
1302
lco_tree.branch.bzrdir.root_transport.base,
1303
lco_tree.branch.repository._format.get_format_description(),
1305
self.assertEqual('', err)
1308
lco_tree.lock_write()
1309
lco_tree.branch.repository.unlock()
1310
out, err = self.runbzr('info tree/lightcheckout')
1311
self.assertEqualDiff(
1313
light checkout root: %s
1314
checkout of branch: %s
1317
control: Meta directory format 1
1318
working tree: Working tree format 3
1319
branch: Branch format 5
1323
working tree: locked
1325
repository: unlocked
1327
In the working tree:
1335
0 versioned subdirectories
1343
""" % (lco_tree.bzrdir.root_transport.base,
1344
lco_tree.branch.bzrdir.root_transport.base,
1345
lco_tree.branch.repository._format.get_format_description(),
1347
self.assertEqual('', err)
1348
lco_tree.branch.repository.lock_write()
1351
lco_tree.lock_write()
1352
lco_tree.branch.unlock()
1353
out, err = self.runbzr('info tree/lightcheckout')
1354
self.assertEqualDiff(
1356
light checkout root: %s
1357
checkout of branch: %s
1360
control: Meta directory format 1
1361
working tree: Working tree format 3
1362
branch: Branch format 5
1366
working tree: locked
1368
repository: unlocked
1370
In the working tree:
1378
0 versioned subdirectories
1386
""" % (lco_tree.bzrdir.root_transport.base,
1387
lco_tree.branch.bzrdir.root_transport.base,
1388
lco_tree.branch.repository._format.get_format_description(),
1390
self.assertEqual('', err)
1391
lco_tree.branch.lock_write()
1394
lco_tree.lock_write()
1395
lco_tree.branch.unlock()
1396
lco_tree.branch.repository.lock_write()
1397
out, err = self.runbzr('info tree/lightcheckout')
1398
self.assertEqualDiff(
1400
light checkout root: %s
1401
checkout of branch: %s
1404
control: Meta directory format 1
1405
working tree: Working tree format 3
1406
branch: Branch format 5
1410
working tree: locked
1414
In the working tree:
1422
0 versioned subdirectories
1430
""" % (lco_tree.bzrdir.root_transport.base,
1431
lco_tree.branch.bzrdir.root_transport.base,
1432
lco_tree.branch.repository._format.get_format_description(),
1434
self.assertEqual('', err)
1435
lco_tree.branch.repository.unlock()
1436
lco_tree.branch.lock_write()
1439
lco_tree.branch.lock_write()
1440
lco_tree.branch.repository.unlock()
1441
out, err = self.runbzr('info tree/lightcheckout')
1442
self.assertEqualDiff(
1444
light checkout root: %s
1445
checkout of branch: %s
1448
control: Meta directory format 1
1449
working tree: Working tree format 3
1450
branch: Branch format 5
1454
working tree: unlocked
1456
repository: unlocked
1458
In the working tree:
1466
0 versioned subdirectories
1474
""" % (lco_tree.bzrdir.root_transport.base,
1475
lco_tree.branch.bzrdir.root_transport.base,
1476
lco_tree.branch.repository._format.get_format_description(),
1478
self.assertEqual('', err)
1479
lco_tree.branch.repository.lock_write()
1480
lco_tree.branch.unlock()
1482
def test_info_locking_oslocks(self):
1483
tree = self.make_branch_and_tree('branch',
1484
format=bzrlib.bzrdir.BzrDirFormat6())
1486
# Test all permutations of locking the working tree, branch and repository
1487
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1488
# implemented by raising NotImplementedError and get_physical_lock_status()
1489
# always returns false. This makes bzr info hide the lock status. (Olaf)
1493
out, err = self.runbzr('info branch')
1494
self.assertEqualDiff(
1499
control: All-in-one format 6
1500
working tree: Working tree format 2
1501
branch: Branch format 4
1504
In the working tree:
1512
0 versioned subdirectories
1520
""" % (tree.bzrdir.root_transport.base,
1521
tree.branch.repository._format.get_format_description(),
1523
self.assertEqual('', err)
1526
out, err = self.runbzr('info branch')
1527
self.assertEqualDiff(
1532
control: All-in-one format 6
1533
working tree: Working tree format 2
1534
branch: Branch format 4
1537
In the working tree:
1545
0 versioned subdirectories
1553
""" % (tree.bzrdir.root_transport.base,
1554
tree.branch.repository._format.get_format_description(),
1556
self.assertEqual('', err)