548
543
dir2.create_workingtree()
549
544
tree2 = dir2.open_workingtree()
550
545
branch2 = tree2.branch
551
self.assertCheckoutStatusOutput('tree/lightcheckout', tree2, shared_repo=repo)
546
out, err = self.runbzr('info tree/lightcheckout')
547
self.assertEqualDiff(
549
light checkout root: %s
550
shared repository: %s
551
repository branch: branch
554
control: Meta directory format 1
555
working tree: Working tree format 3
556
branch: Branch format 5
567
0 versioned subdirectories
575
""" % (tree2.bzrdir.root_transport.base,
576
repo.bzrdir.root_transport.base,
577
repo._format.get_format_description(),
579
self.assertEqual('', err)
553
581
# Create normal checkout
554
582
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
555
583
branch3.bind(branch1)
556
584
tree3 = branch3.bzrdir.open_workingtree()
558
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
560
light_checkout=False, repo_branch=branch1)
586
out, err = self.runbzr('info tree/checkout --verbose')
587
self.assertEqualDiff(
590
checkout of branch: %s
593
control: Meta directory format 1
594
working tree: Working tree format 3
595
branch: Branch format 5
606
0 versioned subdirectories
615
""" % (branch3.bzrdir.root_transport.base,
616
branch1.bzrdir.root_transport.base,
617
repo._format.get_format_description(),
619
self.assertEqual('', err)
561
621
# Update lightweight checkout
562
622
self.build_tree(['tree/lightcheckout/a'])
1088
1148
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)
1193
1150
def test_info_locking(self):
1194
1151
transport = self.get_transport()
1195
1152
# Create shared repository with a branch
1219
self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
1176
out, err = self.runbzr('info tree/lightcheckout')
1177
self.assertEqualDiff(
1179
light checkout root: %s
1180
checkout of branch: %s
1183
control: Meta directory format 1
1184
working tree: Working tree format 3
1185
branch: Branch format 5
1188
In the working tree:
1196
0 versioned subdirectories
1204
""" % (lco_tree.bzrdir.root_transport.base,
1205
lco_tree.branch.bzrdir.root_transport.base,
1206
lco_tree.branch.repository._format.get_format_description(),
1208
self.assertEqual('', err)
1221
1210
lco_tree.branch.repository.lock_write()
1223
self.assertCheckoutStatusOutput('tree/lightcheckout',
1227
lco_tree.branch.repository.unlock()
1211
out, err = self.runbzr('info tree/lightcheckout')
1212
self.assertEqualDiff(
1214
light checkout root: %s
1215
checkout of branch: %s
1218
control: Meta directory format 1
1219
working tree: Working tree format 3
1220
branch: Branch format 5
1224
working tree: unlocked
1228
In the working tree:
1236
0 versioned subdirectories
1244
""" % (lco_tree.bzrdir.root_transport.base,
1245
lco_tree.branch.bzrdir.root_transport.base,
1246
lco_tree.branch.repository._format.get_format_description(),
1248
self.assertEqual('', err)
1249
lco_tree.branch.repository.unlock()
1229
1251
lco_tree.branch.lock_write()
1231
self.assertCheckoutStatusOutput('tree/lightcheckout',
1236
lco_tree.branch.unlock()
1252
out, err = self.runbzr('info tree/lightcheckout')
1253
self.assertEqualDiff(
1255
light checkout root: %s
1256
checkout of branch: %s
1259
control: Meta directory format 1
1260
working tree: Working tree format 3
1261
branch: Branch format 5
1265
working tree: unlocked
1269
In the working tree:
1277
0 versioned subdirectories
1285
""" % (lco_tree.bzrdir.root_transport.base,
1286
lco_tree.branch.bzrdir.root_transport.base,
1287
lco_tree.branch.repository._format.get_format_description(),
1289
self.assertEqual('', err)
1290
lco_tree.branch.unlock()
1238
1292
lco_tree.lock_write()
1240
self.assertCheckoutStatusOutput('tree/lightcheckout',
1293
out, err = self.runbzr('info tree/lightcheckout')
1294
self.assertEqualDiff(
1296
light checkout root: %s
1297
checkout of branch: %s
1300
control: Meta directory format 1
1301
working tree: Working tree format 3
1302
branch: Branch format 5
1306
working tree: locked
1310
In the working tree:
1318
0 versioned subdirectories
1326
""" % (lco_tree.bzrdir.root_transport.base,
1327
lco_tree.branch.bzrdir.root_transport.base,
1328
lco_tree.branch.repository._format.get_format_description(),
1330
self.assertEqual('', err)
1248
1333
lco_tree.lock_write()
1249
1334
lco_tree.branch.repository.unlock()
1251
self.assertCheckoutStatusOutput('tree/lightcheckout',
1256
lco_tree.branch.repository.lock_write()
1335
out, err = self.runbzr('info tree/lightcheckout')
1336
self.assertEqualDiff(
1338
light checkout root: %s
1339
checkout of branch: %s
1342
control: Meta directory format 1
1343
working tree: Working tree format 3
1344
branch: Branch format 5
1348
working tree: locked
1350
repository: unlocked
1352
In the working tree:
1360
0 versioned subdirectories
1368
""" % (lco_tree.bzrdir.root_transport.base,
1369
lco_tree.branch.bzrdir.root_transport.base,
1370
lco_tree.branch.repository._format.get_format_description(),
1372
self.assertEqual('', err)
1373
lco_tree.branch.repository.lock_write()
1259
1376
lco_tree.lock_write()
1260
1377
lco_tree.branch.unlock()
1262
self.assertCheckoutStatusOutput('tree/lightcheckout',
1266
lco_tree.branch.lock_write()
1378
out, err = self.runbzr('info tree/lightcheckout')
1379
self.assertEqualDiff(
1381
light checkout root: %s
1382
checkout of branch: %s
1385
control: Meta directory format 1
1386
working tree: Working tree format 3
1387
branch: Branch format 5
1391
working tree: locked
1393
repository: unlocked
1395
In the working tree:
1403
0 versioned subdirectories
1411
""" % (lco_tree.bzrdir.root_transport.base,
1412
lco_tree.branch.bzrdir.root_transport.base,
1413
lco_tree.branch.repository._format.get_format_description(),
1415
self.assertEqual('', err)
1416
lco_tree.branch.lock_write()
1269
1419
lco_tree.lock_write()
1270
1420
lco_tree.branch.unlock()
1271
1421
lco_tree.branch.repository.lock_write()
1273
self.assertCheckoutStatusOutput('tree/lightcheckout',
1278
lco_tree.branch.repository.unlock()
1279
lco_tree.branch.lock_write()
1422
out, err = self.runbzr('info tree/lightcheckout')
1423
self.assertEqualDiff(
1425
light checkout root: %s
1426
checkout of branch: %s
1429
control: Meta directory format 1
1430
working tree: Working tree format 3
1431
branch: Branch format 5
1435
working tree: locked
1439
In the working tree:
1447
0 versioned subdirectories
1455
""" % (lco_tree.bzrdir.root_transport.base,
1456
lco_tree.branch.bzrdir.root_transport.base,
1457
lco_tree.branch.repository._format.get_format_description(),
1459
self.assertEqual('', err)
1460
lco_tree.branch.repository.unlock()
1461
lco_tree.branch.lock_write()
1282
1464
lco_tree.branch.lock_write()
1283
1465
lco_tree.branch.repository.unlock()
1285
self.assertCheckoutStatusOutput('tree/lightcheckout',
1289
lco_tree.branch.repository.lock_write()
1290
lco_tree.branch.unlock()
1466
out, err = self.runbzr('info tree/lightcheckout')
1467
self.assertEqualDiff(
1469
light checkout root: %s
1470
checkout of branch: %s
1473
control: Meta directory format 1
1474
working tree: Working tree format 3
1475
branch: Branch format 5
1479
working tree: unlocked
1481
repository: unlocked
1483
In the working tree:
1491
0 versioned subdirectories
1499
""" % (lco_tree.bzrdir.root_transport.base,
1500
lco_tree.branch.bzrdir.root_transport.base,
1501
lco_tree.branch.repository._format.get_format_description(),
1503
self.assertEqual('', err)
1504
lco_tree.branch.repository.lock_write()
1505
lco_tree.branch.unlock()
1292
1507
def test_info_locking_oslocks(self):
1293
if sys.platform == "win32":
1294
raise TestSkipped("don't use oslocks on win32 in unix manner")
1296
1508
tree = self.make_branch_and_tree('branch',
1297
1509
format=bzrlib.bzrdir.BzrDirFormat6())