546
548
dir2.create_workingtree()
547
549
tree2 = dir2.open_workingtree()
548
550
branch2 = tree2.branch
549
out, err = self.runbzr('info tree/lightcheckout')
550
self.assertEqualDiff(
552
light checkout root: %s
553
shared repository: %s
554
repository branch: branch
557
control: Meta directory format 1
558
working tree: Working tree format 3
559
branch: Branch format 5
570
0 versioned subdirectories
578
""" % (tree2.bzrdir.root_transport.base,
579
repo.bzrdir.root_transport.base,
580
repo._format.get_format_description(),
582
self.assertEqual('', err)
551
self.assertCheckoutStatusOutput('tree/lightcheckout', tree2, shared_repo=repo)
584
553
# Create normal checkout
585
554
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
586
555
branch3.bind(branch1)
587
556
tree3 = branch3.bzrdir.open_workingtree()
589
out, err = self.runbzr('info tree/checkout --verbose')
590
self.assertEqualDiff(
593
checkout of branch: %s
596
control: Meta directory format 1
597
working tree: Working tree format 3
598
branch: Branch format 5
609
0 versioned subdirectories
618
""" % (branch3.bzrdir.root_transport.base,
619
branch1.bzrdir.root_transport.base,
620
repo._format.get_format_description(),
622
self.assertEqual('', err)
558
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
560
light_checkout=False, repo_branch=branch1)
624
561
# Update lightweight checkout
625
562
self.build_tree(['tree/lightcheckout/a'])
1151
1088
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1090
def assertCheckoutStatusOutput(self,
1091
command_string, lco_tree, shared_repo=None,
1094
branch_locked=False, repo_locked=False,
1096
light_checkout=True):
1097
"""Check the output of info in a light checkout tree.
1099
This is not quite a mirror of the info code: rather than using the
1100
tree being examined to predict output, it uses a bunch of flags which
1101
allow us, the test writers, to document what *should* be present in
1102
the output. Removing this separation would remove the value of the
1105
:param path: the path to the light checkout.
1106
:param lco_tree: the tree object for the light checkout.
1107
:param shared_repo: A shared repository is in use, expect that in
1109
:param repo_branch: A branch in a shared repository for non light
1111
:param tree_locked: If true, expect the tree to be locked.
1112
:param branch_locked: If true, expect the branch to be locked.
1113
:param repo_locked: If true, expect the repository to be locked.
1114
:param verbose: If true, expect verbose output
1116
out, err = self.runbzr('info %s' % command_string)
1117
if repo_locked or branch_locked or tree_locked:
1118
def locked_message(a_bool):
1123
expected_lock_output = (
1126
" working tree: %s\n"
1128
" repository: %s\n" % (
1129
locked_message(tree_locked),
1130
locked_message(branch_locked),
1131
locked_message(repo_locked)))
1133
expected_lock_output = ''
1135
tree_data = (" light checkout root: %s" %
1136
lco_tree.bzrdir.root_transport.base)
1138
tree_data = (" checkout root: %s" %
1139
lco_tree.bzrdir.root_transport.base)
1140
if shared_repo is not None:
1142
" shared repository: %s\n"
1143
" repository branch: branch\n" %
1144
shared_repo.bzrdir.root_transport.base)
1145
elif repo_branch is not None:
1147
" checkout of branch: %s\n" %
1148
repo_branch.bzrdir.root_transport.base)
1150
branch_data = (" checkout of branch: %s\n" %
1151
lco_tree.branch.bzrdir.root_transport.base)
1154
verbose_info = ' 0 committers\n'
1158
self.assertEqualDiff(
1163
control: Meta directory format 1
1165
branch: Branch format 5
1168
In the working tree:
1176
0 versioned subdirectories
1186
lco_tree._format.get_format_description(),
1187
lco_tree.branch.repository._format.get_format_description(),
1188
expected_lock_output,
1191
self.assertEqual('', err)
1153
1193
def test_info_locking(self):
1154
1194
transport = self.get_transport()
1155
1195
# Create shared repository with a branch
1179
out, err = self.runbzr('info tree/lightcheckout')
1180
self.assertEqualDiff(
1182
light checkout root: %s
1183
checkout of branch: %s
1186
control: Meta directory format 1
1187
working tree: Working tree format 3
1188
branch: Branch format 5
1191
In the working tree:
1199
0 versioned subdirectories
1207
""" % (lco_tree.bzrdir.root_transport.base,
1208
lco_tree.branch.bzrdir.root_transport.base,
1209
lco_tree.branch.repository._format.get_format_description(),
1211
self.assertEqual('', err)
1219
self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
1213
1221
lco_tree.branch.repository.lock_write()
1214
out, err = self.runbzr('info tree/lightcheckout')
1215
self.assertEqualDiff(
1217
light checkout root: %s
1218
checkout of branch: %s
1221
control: Meta directory format 1
1222
working tree: Working tree format 3
1223
branch: Branch format 5
1227
working tree: unlocked
1231
In the working tree:
1239
0 versioned subdirectories
1247
""" % (lco_tree.bzrdir.root_transport.base,
1248
lco_tree.branch.bzrdir.root_transport.base,
1249
lco_tree.branch.repository._format.get_format_description(),
1251
self.assertEqual('', err)
1252
lco_tree.branch.repository.unlock()
1223
self.assertCheckoutStatusOutput('tree/lightcheckout',
1227
lco_tree.branch.repository.unlock()
1254
1229
lco_tree.branch.lock_write()
1255
out, err = self.runbzr('info tree/lightcheckout')
1256
self.assertEqualDiff(
1258
light checkout root: %s
1259
checkout of branch: %s
1262
control: Meta directory format 1
1263
working tree: Working tree format 3
1264
branch: Branch format 5
1268
working tree: unlocked
1272
In the working tree:
1280
0 versioned subdirectories
1288
""" % (lco_tree.bzrdir.root_transport.base,
1289
lco_tree.branch.bzrdir.root_transport.base,
1290
lco_tree.branch.repository._format.get_format_description(),
1292
self.assertEqual('', err)
1293
lco_tree.branch.unlock()
1231
self.assertCheckoutStatusOutput('tree/lightcheckout',
1236
lco_tree.branch.unlock()
1295
1238
lco_tree.lock_write()
1296
out, err = self.runbzr('info tree/lightcheckout')
1297
self.assertEqualDiff(
1299
light checkout root: %s
1300
checkout of branch: %s
1303
control: Meta directory format 1
1304
working tree: Working tree format 3
1305
branch: Branch format 5
1309
working tree: locked
1313
In the working tree:
1321
0 versioned subdirectories
1329
""" % (lco_tree.bzrdir.root_transport.base,
1330
lco_tree.branch.bzrdir.root_transport.base,
1331
lco_tree.branch.repository._format.get_format_description(),
1333
self.assertEqual('', err)
1240
self.assertCheckoutStatusOutput('tree/lightcheckout',
1336
1248
lco_tree.lock_write()
1337
1249
lco_tree.branch.repository.unlock()
1338
out, err = self.runbzr('info tree/lightcheckout')
1339
self.assertEqualDiff(
1341
light checkout root: %s
1342
checkout of branch: %s
1345
control: Meta directory format 1
1346
working tree: Working tree format 3
1347
branch: Branch format 5
1351
working tree: locked
1353
repository: unlocked
1355
In the working tree:
1363
0 versioned subdirectories
1371
""" % (lco_tree.bzrdir.root_transport.base,
1372
lco_tree.branch.bzrdir.root_transport.base,
1373
lco_tree.branch.repository._format.get_format_description(),
1375
self.assertEqual('', err)
1376
lco_tree.branch.repository.lock_write()
1251
self.assertCheckoutStatusOutput('tree/lightcheckout',
1256
lco_tree.branch.repository.lock_write()
1379
1259
lco_tree.lock_write()
1380
1260
lco_tree.branch.unlock()
1381
out, err = self.runbzr('info tree/lightcheckout')
1382
self.assertEqualDiff(
1384
light checkout root: %s
1385
checkout of branch: %s
1388
control: Meta directory format 1
1389
working tree: Working tree format 3
1390
branch: Branch format 5
1394
working tree: locked
1396
repository: unlocked
1398
In the working tree:
1406
0 versioned subdirectories
1414
""" % (lco_tree.bzrdir.root_transport.base,
1415
lco_tree.branch.bzrdir.root_transport.base,
1416
lco_tree.branch.repository._format.get_format_description(),
1418
self.assertEqual('', err)
1419
lco_tree.branch.lock_write()
1262
self.assertCheckoutStatusOutput('tree/lightcheckout',
1266
lco_tree.branch.lock_write()
1422
1269
lco_tree.lock_write()
1423
1270
lco_tree.branch.unlock()
1424
1271
lco_tree.branch.repository.lock_write()
1425
out, err = self.runbzr('info tree/lightcheckout')
1426
self.assertEqualDiff(
1428
light checkout root: %s
1429
checkout of branch: %s
1432
control: Meta directory format 1
1433
working tree: Working tree format 3
1434
branch: Branch format 5
1438
working tree: locked
1442
In the working tree:
1450
0 versioned subdirectories
1458
""" % (lco_tree.bzrdir.root_transport.base,
1459
lco_tree.branch.bzrdir.root_transport.base,
1460
lco_tree.branch.repository._format.get_format_description(),
1462
self.assertEqual('', err)
1463
lco_tree.branch.repository.unlock()
1464
lco_tree.branch.lock_write()
1273
self.assertCheckoutStatusOutput('tree/lightcheckout',
1278
lco_tree.branch.repository.unlock()
1279
lco_tree.branch.lock_write()
1467
1282
lco_tree.branch.lock_write()
1468
1283
lco_tree.branch.repository.unlock()
1469
out, err = self.runbzr('info tree/lightcheckout')
1470
self.assertEqualDiff(
1472
light checkout root: %s
1473
checkout of branch: %s
1476
control: Meta directory format 1
1477
working tree: Working tree format 3
1478
branch: Branch format 5
1482
working tree: unlocked
1484
repository: unlocked
1486
In the working tree:
1494
0 versioned subdirectories
1502
""" % (lco_tree.bzrdir.root_transport.base,
1503
lco_tree.branch.bzrdir.root_transport.base,
1504
lco_tree.branch.repository._format.get_format_description(),
1506
self.assertEqual('', err)
1507
lco_tree.branch.repository.lock_write()
1508
lco_tree.branch.unlock()
1285
self.assertCheckoutStatusOutput('tree/lightcheckout',
1289
lco_tree.branch.repository.lock_write()
1290
lco_tree.branch.unlock()
1510
1292
def test_info_locking_oslocks(self):
1511
1293
if sys.platform == "win32":