48
48
self.build_tree(['standalone/a'])
50
50
branch1 = tree1.branch
51
out, err = self.runbzr('info standalone')
51
out, err = self.runbzr('info standalone -v')
52
52
self.assertEqualDiff(
53
"""Standalone tree (format: weave)
138
141
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
139
142
branch3.bind(branch1)
140
143
bound_tree = branch3.bzrdir.open_workingtree()
141
out, err = self.runbzr('info bound')
144
out, err = self.runbzr('info -v bound')
142
145
self.assertEqualDiff(
146
"""Checkout (format: knit)
144
148
checkout root: %s
145
149
checkout of branch: %s
237
243
# Lightweight checkout (same as above, different branch and repository)
238
244
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
239
245
branch5 = tree5.branch
240
out, err = self.runbzr('info lightcheckout')
246
out, err = self.runbzr('info -v lightcheckout')
241
247
self.assertEqualDiff(
243
light checkout root: %s
244
checkout of branch: %s
248
"""Lightweight checkout (format: dirstate or dirstate-tags)
250
light checkout root: %s
251
checkout of branch: %s
247
254
control: Meta directory format 1
282
290
datestring_last = format_date(rev.timestamp, rev.timezone)
284
292
# Out of date branched standalone branch will not be detected
285
out, err = self.runbzr('info branch')
293
out, err = self.runbzr('info -v branch')
286
294
self.assertEqualDiff(
295
"""Standalone tree (format: weave)
290
299
Related branches:
324
334
self.assertEqual('', err)
326
336
# Out of date bound branch
327
out, err = self.runbzr('info bound')
337
out, err = self.runbzr('info -v bound')
328
338
self.assertEqualDiff(
339
"""Checkout (format: knit)
330
341
checkout root: %s
331
342
checkout of branch: %s
373
385
self.assertEqual('', err)
375
387
# Out of date checkout
376
out, err = self.runbzr('info checkout')
388
out, err = self.runbzr('info -v checkout')
377
389
self.assertEqualDiff(
390
"""Checkout (format: knit)
379
392
checkout root: %s
380
393
checkout of branch: %s
420
434
# Out of date lightweight checkout
421
435
out, err = self.runbzr('info lightcheckout --verbose')
422
436
self.assertEqualDiff(
424
light checkout root: %s
425
checkout of branch: %s
437
"""Lightweight checkout (format: dirstate or dirstate-tags)
439
light checkout root: %s
440
checkout of branch: %s
428
443
control: Meta directory format 1
463
478
format = bzrdir.format_registry.make_bzrdir('default')
464
479
branch = self.make_branch('branch')
465
480
repo = branch.repository
466
out, err = self.runbzr('info branch')
481
out, err = self.runbzr('info branch -v')
467
482
self.assertEqualDiff(
483
"""Standalone branch (format: dirstate or knit)
492
509
# Create shared repository
493
510
repo = self.make_repository('repo', shared=True, format=format)
494
511
repo.set_make_working_trees(False)
495
out, err = self.runbzr('info repo')
512
out, err = self.runbzr('info -v repo')
496
513
self.assertEqualDiff(
514
"""Shared repository (format: dirstate or dirstate-tags or knit)
498
516
shared repository: %s
513
531
repo.bzrdir.root_transport.mkdir('branch')
514
532
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
516
out, err = self.runbzr('info repo/branch')
534
out, err = self.runbzr('info -v repo/branch')
517
535
self.assertEqualDiff(
536
"""Repository branch (format: dirstate or knit)
519
538
shared repository: %s
520
539
repository branch: branch
542
562
tree2 = branch1.create_checkout('tree/lightcheckout',
543
563
lightweight=True)
544
564
branch2 = tree2.branch
545
self.assertCheckoutStatusOutput('tree/lightcheckout', tree2,
565
self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
566
shared_repo=repo, repo_branch=branch1, verbose=True)
548
568
# Create normal checkout
549
569
tree3 = branch1.create_checkout('tree/checkout')
558
578
datestring_first = format_date(rev.timestamp, rev.timezone)
559
579
out, err = self.runbzr('info tree/lightcheckout --verbose')
560
580
self.assertEqualDiff(
562
light checkout root: %s
563
shared repository: %s
564
repository branch: branch
581
"""Lightweight checkout (format: dirstate or dirstate-tags)
583
light checkout root: %s
584
checkout of branch: %s
585
shared repository: %s
567
588
control: Meta directory format 1
592
613
""" % (tree2.bzrdir.root_transport.base,
614
tree2.branch.bzrdir.root_transport.base,
593
615
repo.bzrdir.root_transport.base,
594
616
format.get_branch_format().get_format_description(),
595
617
format.repository_format.get_format_description(),
601
623
self.assertEqual('', err)
603
625
# Out of date checkout
604
out, err = self.runbzr('info tree/checkout')
626
out, err = self.runbzr('info -v tree/checkout')
605
627
self.assertEqualDiff(
628
"""Checkout (format: dirstate)
607
630
checkout root: %s
608
631
checkout of branch: %s
690
715
datestring_last = format_date(rev.timestamp, rev.timezone)
691
716
out, err = self.runbzr('info tree/lightcheckout --verbose')
692
717
self.assertEqualDiff(
694
light checkout root: %s
695
shared repository: %s
696
repository branch: branch
718
"""Lightweight checkout (format: dirstate or dirstate-tags)
720
light checkout root: %s
721
checkout of branch: %s
722
shared repository: %s
699
725
control: Meta directory format 1
726
752
""" % (tree2.bzrdir.root_transport.base,
753
tree2.branch.bzrdir.root_transport.base,
727
754
repo.bzrdir.root_transport.base,
728
755
format.get_branch_format().get_format_description(),
729
756
format.repository_format.get_format_description(),
737
764
# Show info about shared branch
738
765
out, err = self.runbzr('info repo/branch --verbose')
739
766
self.assertEqualDiff(
767
"""Repository branch (format: dirstate or knit)
741
769
shared repository: %s
742
770
repository branch: branch
767
795
self.assertEqual('', err)
769
797
# Show info about repository with revisions
770
out, err = self.runbzr('info repo')
798
out, err = self.runbzr('info -v repo')
771
799
self.assertEqualDiff(
800
"""Shared repository (format: dirstate or dirstate-tags or knit)
773
802
shared repository: %s
794
823
# Create shared repository with working trees
795
824
repo = self.make_repository('repo', shared=True, format=format)
796
825
repo.set_make_working_trees(True)
797
out, err = self.runbzr('info repo')
826
out, err = self.runbzr('info -v repo')
798
827
self.assertEqualDiff(
828
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
800
830
shared repository: %s
822
852
# Empty first branch
823
853
out, err = self.runbzr('info repo/branch1 --verbose')
824
854
self.assertEqualDiff(
826
shared repository: %s
827
repository checkout: branch1
855
"""Repository tree (format: knit)
857
shared repository: %s
858
repository branch: branch1
830
861
control: Meta directory format 1
862
893
tree1.commit('commit one')
863
894
rev = repo.get_revision(branch1.revision_history()[0])
864
895
datestring_first = format_date(rev.timestamp, rev.timezone)
865
out, err = self.runbzr('info repo/branch1')
896
out, err = self.runbzr('info -v repo/branch1')
866
897
self.assertEqualDiff(
868
shared repository: %s
869
repository checkout: branch1
898
"""Repository tree (format: knit)
900
shared repository: %s
901
repository branch: branch1
872
904
control: Meta directory format 1
906
939
# Out of date second branch
907
940
out, err = self.runbzr('info repo/branch2 --verbose')
908
941
self.assertEqualDiff(
910
shared repository: %s
911
repository checkout: branch2
942
"""Repository tree (format: knit)
944
shared repository: %s
945
repository branch: branch2
913
947
Related branches:
914
948
parent branch: %s
949
983
# Update second branch
950
984
tree2 = branch2.bzrdir.open_workingtree()
951
985
tree2.pull(branch1)
952
out, err = self.runbzr('info repo/branch2')
986
out, err = self.runbzr('info -v repo/branch2')
953
987
self.assertEqualDiff(
955
shared repository: %s
956
repository checkout: branch2
988
"""Repository tree (format: knit)
990
shared repository: %s
991
repository branch: branch2
958
993
Related branches:
959
994
parent branch: %s
995
1031
self.assertEqual('', err)
997
1033
# Show info about repository with revisions
998
out, err = self.runbzr('info repo')
1034
out, err = self.runbzr('info -v repo')
999
1035
self.assertEqualDiff(
1036
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1001
1038
shared repository: %s
1025
1062
# Create shared repository with working trees
1026
1063
repo = self.make_repository('repo', shared=True, format=format)
1027
1064
repo.set_make_working_trees(True)
1028
out, err = self.runbzr('info repo')
1065
out, err = self.runbzr('info -v repo')
1029
1066
self.assertEqualDiff(
1067
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1031
1069
shared repository: %s
1048
1086
control = repo.bzrdir
1049
1087
branch = control.create_branch()
1050
1088
control.create_workingtree()
1051
out, err = self.runbzr('info repo')
1089
out, err = self.runbzr('info -v repo')
1052
1090
self.assertEqualDiff(
1054
shared repository: %s
1055
repository checkout: .
1091
"""Repository tree (format: knit)
1093
shared repository: %s
1094
repository branch: .
1058
1097
control: Meta directory format 1
1088
1128
tree_locked=False,
1089
1129
branch_locked=False, repo_locked=False,
1091
light_checkout=True):
1092
"""Check the output of info in a light checkout tree.
1131
light_checkout=True,
1132
checkout_root=None):
1133
"""Check the output of info in a checkout.
1094
1135
This is not quite a mirror of the info code: rather than using the
1095
1136
tree being examined to predict output, it uses a bunch of flags which
1116
1157
self.run_bzr_error([], 'info', *args)
1118
1159
out, err = self.runbzr('info %s' % command_string)
1161
(True, True): 'Lightweight checkout',
1162
(True, False): 'Repository checkout',
1163
(False, True): 'Lightweight checkout',
1164
(False, False): 'Checkout',
1165
}[(shared_repo is not None, light_checkout)]
1166
format = {True: 'dirstate or dirstate-tags',
1167
False: 'dirstate'}[light_checkout]
1119
1168
if repo_locked or branch_locked or tree_locked:
1120
1169
def locked_message(a_bool):
1133
1182
locked_message(repo_locked)))
1135
1184
expected_lock_output = ''
1136
1187
if light_checkout:
1137
tree_data = (" light checkout root: %s" %
1138
lco_tree.bzrdir.root_transport.base)
1140
tree_data = (" checkout root: %s" %
1141
lco_tree.bzrdir.root_transport.base)
1188
tree_data = (" light checkout root: %s\n" %
1189
lco_tree.bzrdir.root_transport.base)
1191
if lco_tree.branch.get_bound_location() is not None:
1192
tree_data += ("%s checkout root: %s\n" % (extra_space,
1193
lco_tree.branch.bzrdir.root_transport.base))
1142
1194
if shared_repo is not None:
1143
1195
branch_data = (
1144
" shared repository: %s\n"
1145
" repository branch: branch\n" %
1146
shared_repo.bzrdir.root_transport.base)
1196
" checkout of branch: %s\n"
1197
" shared repository: %s\n" %
1198
(repo_branch.bzrdir.root_transport.base,
1199
shared_repo.bzrdir.root_transport.base))
1147
1200
elif repo_branch is not None:
1148
1201
branch_data = (
1149
" checkout of branch: %s\n" %
1150
repo_branch.bzrdir.root_transport.base)
1202
"%s checkout of branch: %s\n" %
1204
repo_branch.bzrdir.root_transport.base))
1152
branch_data = (" checkout of branch: %s\n" %
1206
branch_data = (" checkout of branch: %s\n" %
1153
1207
lco_tree.branch.bzrdir.root_transport.base)
1222
self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
1278
self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1279
repo_branch=repo_branch,
1280
verbose=True, light_checkout=True)
1224
1282
lco_tree.branch.repository.lock_write()
1226
self.assertCheckoutStatusOutput('tree/lightcheckout',
1284
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1285
lco_tree, repo_branch=repo_branch,
1286
repo_locked=True, verbose=True, light_checkout=True)
1230
1288
lco_tree.branch.repository.unlock()
1232
1290
lco_tree.branch.lock_write()
1234
self.assertCheckoutStatusOutput('tree/lightcheckout',
1292
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1236
1294
branch_locked=True,
1296
repo_branch=repo_branch,
1239
1299
lco_tree.branch.unlock()
1241
1301
lco_tree.lock_write()
1243
self.assertCheckoutStatusOutput('tree/lightcheckout',
1303
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1304
lco_tree, repo_branch=repo_branch,
1245
1305
tree_locked=True,
1246
1306
branch_locked=True,
1249
1310
lco_tree.unlock()
1251
1312
lco_tree.lock_write()
1252
1313
lco_tree.branch.repository.unlock()
1254
self.assertCheckoutStatusOutput('tree/lightcheckout',
1315
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1316
lco_tree, repo_branch=repo_branch,
1256
1317
tree_locked=True,
1259
1321
lco_tree.branch.repository.lock_write()
1260
1322
lco_tree.unlock()
1262
1324
lco_tree.lock_write()
1263
1325
lco_tree.branch.unlock()
1265
self.assertCheckoutStatusOutput('tree/lightcheckout',
1327
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1328
lco_tree, repo_branch=repo_branch,
1269
1332
lco_tree.branch.lock_write()
1270
1333
lco_tree.unlock()
1273
1336
lco_tree.branch.unlock()
1274
1337
lco_tree.branch.repository.lock_write()
1276
self.assertCheckoutStatusOutput('tree/lightcheckout',
1339
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1340
lco_tree, repo_branch=repo_branch,
1278
1341
tree_locked=True,
1281
1345
lco_tree.branch.repository.unlock()
1282
1346
lco_tree.branch.lock_write()
1285
1349
lco_tree.branch.lock_write()
1286
1350
lco_tree.branch.repository.unlock()
1288
self.assertCheckoutStatusOutput('tree/lightcheckout',
1352
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1353
lco_tree, repo_branch=repo_branch,
1292
1357
lco_tree.branch.repository.lock_write()
1293
1358
lco_tree.branch.unlock()
1343
1410
self.assertEqual('', err)
1345
1412
tree.lock_write()
1346
out, err = self.runbzr('info branch')
1413
out, err = self.runbzr('info -v branch')
1347
1414
self.assertEqualDiff(
1415
"""Standalone tree (format: weave)
1349
1417
branch root: %s