543
548
dir2.create_workingtree()
544
549
tree2 = dir2.open_workingtree()
545
550
branch2 = tree2.branch
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)
551
self.assertCheckoutStatusOutput('tree/lightcheckout', tree2, shared_repo=repo)
581
553
# Create normal checkout
582
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
583
branch3.bind(branch1)
584
tree3 = branch3.bzrdir.open_workingtree()
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)
554
tree3 = branch1.create_checkout('tree/checkout')
555
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
557
light_checkout=False, repo_branch=branch1)
621
558
# Update lightweight checkout
622
559
self.build_tree(['tree/lightcheckout/a'])
1148
1085
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1087
def assertCheckoutStatusOutput(self,
1088
command_string, lco_tree, shared_repo=None,
1091
branch_locked=False, repo_locked=False,
1093
light_checkout=True):
1094
"""Check the output of info in a light checkout tree.
1096
This is not quite a mirror of the info code: rather than using the
1097
tree being examined to predict output, it uses a bunch of flags which
1098
allow us, the test writers, to document what *should* be present in
1099
the output. Removing this separation would remove the value of the
1102
:param path: the path to the light checkout.
1103
:param lco_tree: the tree object for the light checkout.
1104
:param shared_repo: A shared repository is in use, expect that in
1106
:param repo_branch: A branch in a shared repository for non light
1108
:param tree_locked: If true, expect the tree to be locked.
1109
:param branch_locked: If true, expect the branch to be locked.
1110
:param repo_locked: If true, expect the repository to be locked.
1111
:param verbose: If true, expect verbose output
1113
out, err = self.runbzr('info %s' % command_string)
1114
if repo_locked or branch_locked or tree_locked:
1115
def locked_message(a_bool):
1120
expected_lock_output = (
1123
" working tree: %s\n"
1125
" repository: %s\n" % (
1126
locked_message(tree_locked),
1127
locked_message(branch_locked),
1128
locked_message(repo_locked)))
1130
expected_lock_output = ''
1132
tree_data = (" light checkout root: %s" %
1133
lco_tree.bzrdir.root_transport.base)
1135
tree_data = (" checkout root: %s" %
1136
lco_tree.bzrdir.root_transport.base)
1137
if shared_repo is not None:
1139
" shared repository: %s\n"
1140
" repository branch: branch\n" %
1141
shared_repo.bzrdir.root_transport.base)
1142
elif repo_branch is not None:
1144
" checkout of branch: %s\n" %
1145
repo_branch.bzrdir.root_transport.base)
1147
branch_data = (" checkout of branch: %s\n" %
1148
lco_tree.branch.bzrdir.root_transport.base)
1151
verbose_info = ' 0 committers\n'
1155
self.assertEqualDiff(
1160
control: Meta directory format 1
1162
branch: Branch format 5
1165
In the working tree:
1173
0 versioned subdirectories
1183
lco_tree._format.get_format_description(),
1184
lco_tree.branch.repository._format.get_format_description(),
1185
expected_lock_output,
1188
self.assertEqual('', err)
1150
1190
def test_info_locking(self):
1151
1191
transport = self.get_transport()
1152
1192
# Create shared repository with a branch
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)
1216
self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
1210
1218
lco_tree.branch.repository.lock_write()
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()
1220
self.assertCheckoutStatusOutput('tree/lightcheckout',
1224
lco_tree.branch.repository.unlock()
1251
1226
lco_tree.branch.lock_write()
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()
1228
self.assertCheckoutStatusOutput('tree/lightcheckout',
1233
lco_tree.branch.unlock()
1292
1235
lco_tree.lock_write()
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)
1237
self.assertCheckoutStatusOutput('tree/lightcheckout',
1333
1245
lco_tree.lock_write()
1334
1246
lco_tree.branch.repository.unlock()
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()
1248
self.assertCheckoutStatusOutput('tree/lightcheckout',
1253
lco_tree.branch.repository.lock_write()
1376
1256
lco_tree.lock_write()
1377
1257
lco_tree.branch.unlock()
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()
1259
self.assertCheckoutStatusOutput('tree/lightcheckout',
1263
lco_tree.branch.lock_write()
1419
1266
lco_tree.lock_write()
1420
1267
lco_tree.branch.unlock()
1421
1268
lco_tree.branch.repository.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()
1270
self.assertCheckoutStatusOutput('tree/lightcheckout',
1275
lco_tree.branch.repository.unlock()
1276
lco_tree.branch.lock_write()
1464
1279
lco_tree.branch.lock_write()
1465
1280
lco_tree.branch.repository.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()
1282
self.assertCheckoutStatusOutput('tree/lightcheckout',
1286
lco_tree.branch.repository.lock_write()
1287
lco_tree.branch.unlock()
1507
1289
def test_info_locking_oslocks(self):
1290
if sys.platform == "win32":
1291
raise TestSkipped("don't use oslocks on win32 in unix manner")
1508
1293
tree = self.make_branch_and_tree('branch',
1509
1294
format=bzrlib.bzrdir.BzrDirFormat6())