43
48
location = self.get_url()
44
49
out, err = self.run_bzr('info '+location, retcode=3)
45
50
self.assertEqual(out, '')
46
self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
51
self.assertEqual(err, 'brz: ERROR: Not a branch: "%s".\n' % location)
53
def test_info_empty_controldir(self):
54
self.make_controldir('ctrl')
55
out, err = self.run_bzr('info ctrl')
57
b'Empty control directory (format: 2a)\n'
59
b' control directory: ctrl\n')
60
self.assertEqual(err, b'')
62
def test_info_empty_controldir_verbose(self):
63
self.make_controldir('ctrl')
64
out, err = self.run_bzr('info -v ctrl')
65
self.assertEqualDiff(out,
66
b'Empty control directory (format: 2a)\n'
68
b' control directory: ctrl\n\n'
70
b' control: Meta directory format 1\n\n'
71
b'Control directory:\n'
73
self.assertEqual(err, b'')
75
def test_info_dangling_branch_reference(self):
76
br = self.make_branch('target')
77
br.create_checkout('from', lightweight=True)
78
shutil.rmtree('target')
79
out, err = self.run_bzr('info from')
81
b'Dangling branch reference (format: 2a)\n'
83
b' control directory: from\n'
84
b' checkout of branch: target\n')
85
self.assertEqual(err, b'')
48
87
def test_info_standalone(self):
49
88
transport = self.get_transport()
51
90
# Create initial standalone branch
52
tree1 = self.make_branch_and_tree('standalone', 'weave')
91
tree1 = self.make_branch_and_tree('standalone', 'knit')
53
92
self.build_tree(['standalone/a'])
55
94
branch1 = tree1.branch
57
96
out, err = self.run_bzr('info standalone')
58
97
self.assertEqualDiff(
59
"""Standalone tree (format: weave)
98
b"""Standalone tree (format: knit)
61
100
branch root: standalone
63
self.assertEqual('', err)
102
self.assertEqual(b'', err)
65
104
# Standalone branch - verbose mode
66
105
out, err = self.run_bzr('info standalone -v')
67
106
self.assertEqualDiff(
68
"""Standalone tree (format: weave)
107
b"""Standalone tree (format: knit)
70
109
branch root: standalone
73
control: All-in-one format 6
74
working tree: Working tree format 2
75
branch: Branch format 4
76
repository: Weave repository format 6
112
control: Meta directory format 1
113
working tree: Working tree format 3
114
branch: Branch format 5
115
repository: Knit repository format 1
78
120
In the working tree:
94
self.assertEqual('', err)
136
self.assertEqual(b'', err)
96
138
# Standalone branch - really verbose mode
97
139
out, err = self.run_bzr('info standalone -vv')
98
140
self.assertEqualDiff(
99
"""Standalone tree (format: weave)
141
b"""Standalone tree (format: knit)
101
143
branch root: standalone
104
control: All-in-one format 6
105
working tree: Working tree format 2
106
branch: Branch format 4
107
repository: Weave repository format 6
146
control: Meta directory format 1
147
working tree: Working tree format 3
148
branch: Branch format 5
149
repository: Knit repository format 1
109
154
In the working tree:
126
self.assertEqual('', err)
171
self.assertEqual(b'', err)
127
172
tree1.commit('commit one')
128
rev = branch1.repository.get_revision(branch1.revision_history()[0])
173
rev = branch1.repository.get_revision(branch1.last_revision())
129
174
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
131
176
# Branch standalone with push location
132
branch2 = branch1.bzrdir.sprout('branch').open_branch()
133
branch2.set_push_location(branch1.bzrdir.root_transport.base)
177
branch2 = branch1.controldir.sprout('branch').open_branch()
178
branch2.set_push_location(branch1.controldir.root_transport.base)
135
180
out, err = self.run_bzr('info branch')
136
181
self.assertEqualDiff(
137
"""Standalone tree (format: weave)
182
"""Standalone tree (format: knit)
139
184
branch root: branch
181
229
""" % (datestring_first, datestring_first,
183
self.assertEqual('', err)
231
self.assertEqual(b'', err)
185
233
# Branch and bind to standalone, needs upgrade to metadir
186
234
# (creates backup as unknown)
187
branch1.bzrdir.sprout('bound')
188
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
235
branch1.controldir.sprout('bound')
236
knit1_format = controldir.format_registry.make_controldir('knit')
189
237
upgrade.upgrade('bound', knit1_format)
190
branch3 = bzrdir.BzrDir.open('bound').open_branch()
238
branch3 = controldir.ControlDir.open('bound').open_branch()
191
239
branch3.bind(branch1)
192
bound_tree = branch3.bzrdir.open_workingtree()
240
bound_tree = branch3.controldir.open_workingtree()
193
241
out, err = self.run_bzr('info -v bound')
194
242
self.assertEqualDiff(
195
"""Checkout (format: knit)
243
b"""Checkout (format: knit)
197
245
checkout root: bound
198
246
checkout of branch: standalone
229
280
branch3.repository._format.get_format_description(),
230
281
datestring_first, datestring_first,
232
self.assertEqual('', err)
283
self.assertEqual(b'', err)
234
285
# Checkout standalone (same as above, but does not have parent set)
235
branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
286
branch4 = controldir.ControlDir.create_branch_convenience('checkout',
236
287
format=knit1_format)
237
288
branch4.bind(branch1)
238
branch4.bzrdir.open_workingtree().update()
289
branch4.controldir.open_workingtree().update()
239
290
out, err = self.run_bzr('info checkout --verbose')
240
291
self.assertEqualDiff(
241
"""Checkout (format: knit)
292
b"""Checkout (format: knit)
243
294
checkout root: checkout
244
295
checkout of branch: standalone
270
324
""" % (branch4.repository._format.get_format_description(),
271
325
datestring_first, datestring_first,
273
self.assertEqual('', err)
327
self.assertEqual(b'', err)
275
329
# Lightweight checkout (same as above, different branch and repository)
276
330
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
277
331
branch5 = tree5.branch
278
332
out, err = self.run_bzr('info -v lightcheckout')
333
if "metaweave" in controldir.format_registry:
334
format_description = "knit or metaweave"
336
format_description = "knit"
279
337
self.assertEqualDiff(
280
338
"""Lightweight checkout (format: %s)
309
""" % (self._repo_strings, datestring_first, datestring_first,), out)
310
self.assertEqual('', err)
370
""" % (format_description, datestring_first, datestring_first,), out)
371
self.assertEqual(b'', err)
312
373
# Update initial standalone branch
313
374
self.build_tree(['standalone/b'])
315
376
tree1.commit('commit two')
316
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
377
rev = branch1.repository.get_revision(branch1.last_revision())
317
378
datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
319
380
# Out of date branched standalone branch will not be detected
320
381
out, err = self.run_bzr('info -v branch')
321
382
self.assertEqualDiff(
322
"""Standalone tree (format: weave)
383
b"""Standalone tree (format: knit)
324
385
branch root: branch
354
418
""" % (datestring_first, datestring_first,
356
self.assertEqual('', err)
420
self.assertEqual(b'', err)
358
422
# Out of date bound branch
359
423
out, err = self.run_bzr('info -v bound')
360
424
self.assertEqualDiff(
361
"""Checkout (format: knit)
425
b"""Checkout (format: knit)
363
427
checkout root: bound
364
428
checkout of branch: standalone
395
462
""" % (branch3.repository._format.get_format_description(),
396
463
datestring_first, datestring_first,
398
self.assertEqual('', err)
465
self.assertEqual(b'', err)
400
467
# Out of date checkout
401
468
out, err = self.run_bzr('info -v checkout')
402
469
self.assertEqualDiff(
403
"""Checkout (format: knit)
470
b"""Checkout (format: knit)
405
472
checkout root: checkout
406
473
checkout of branch: standalone
434
504
""" % (branch4.repository._format.get_format_description(),
435
505
datestring_first, datestring_first,
437
self.assertEqual('', err)
507
self.assertEqual(b'', err)
439
509
# Out of date lightweight checkout
440
510
out, err = self.run_bzr('info lightcheckout --verbose')
441
511
self.assertEqualDiff(
442
"""Lightweight checkout (format: %s)
512
b"""Lightweight checkout (format: %s)
444
514
light checkout root: lightcheckout
445
515
checkout of branch: standalone
448
518
control: Meta directory format 1
449
working tree: Working tree format 6
450
branch: Branch format 4
451
repository: Weave repository format 6
519
working tree: Working tree format 3
520
branch: Branch format 5
521
repository: Knit repository format 1
453
526
Working tree is out of date: missing 1 revision.
473
""" % (self._repo_strings, datestring_first, datestring_last,), out)
474
self.assertEqual('', err)
546
""" % (format_description, datestring_first, datestring_last,), out)
547
self.assertEqual(b'', err)
476
549
def test_info_standalone_no_tree(self):
477
550
# create standalone branch without a working tree
478
format = bzrdir.format_registry.make_bzrdir('default')
551
format = controldir.format_registry.make_controldir('default')
479
552
branch = self.make_branch('branch')
480
553
repo = branch.repository
481
554
out, err = self.run_bzr('info branch -v')
482
555
self.assertEqualDiff(
483
"""Standalone branch (format: %s)
556
b"""Standalone branch (format: %s)
485
558
branch root: branch
497
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
498
format.get_branch_format().get_format_description(),
499
format.repository_format.get_format_description(),
573
""" % (info.describe_format(repo.controldir, repo, branch, None).encode('ascii'),
574
format.get_branch_format().get_format_description().encode('ascii'),
575
format.repository_format.get_format_description().encode('ascii'),
501
self.assertEqual('', err)
577
self.assertEqual(b'', err)
503
579
def test_info_shared_repository(self):
504
format = bzrdir.format_registry.make_bzrdir('knit')
580
format = controldir.format_registry.make_controldir('knit')
505
581
transport = self.get_transport()
507
583
# Create shared repository
517
593
control: Meta directory format 1
522
""" % ('repo', format.repository_format.get_format_description(),
601
""" % (b'repo', format.repository_format.get_format_description().encode('ascii'),
524
self.assertEqual('', err)
603
self.assertEqual(b'', err)
526
605
# Create branch inside shared repository
527
repo.bzrdir.root_transport.mkdir('branch')
528
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
606
repo.controldir.root_transport.mkdir('branch')
607
branch1 = controldir.ControlDir.create_branch_convenience(
608
'repo/branch', format=format)
530
609
out, err = self.run_bzr('info -v repo/branch')
531
610
self.assertEqualDiff(
532
"""Repository branch (format: dirstate or knit)
611
b"""Repository branch (format: dirstate or knit)
534
613
shared repository: repo
535
614
repository branch: repo/branch
547
""" % (format.get_branch_format().get_format_description(),
548
format.repository_format.get_format_description(),
629
""" % (format.get_branch_format().get_format_description().encode('ascii'),
630
format.repository_format.get_format_description().encode('ascii'),
550
self.assertEqual('', err)
632
self.assertEqual(b'', err)
552
634
# Create lightweight checkout
553
635
transport.mkdir('tree')
605
690
format.repository_format.get_format_description(),
606
691
datestring_first, datestring_first,
608
self.assertEqual('', err)
693
self.assertEqual(b'', err)
610
695
# Out of date checkout
611
696
out, err = self.run_bzr('info -v tree/checkout')
612
697
self.assertEqualDiff(
613
"""Checkout (format: unnamed)
698
b"""Checkout (format: unnamed)
615
700
checkout root: tree/checkout
616
701
checkout of branch: repo/branch
682
773
format.repository_format.get_format_description(),
683
774
datestring_first, datestring_first,
685
self.assertEqual('', err)
776
self.assertEqual(b'', err)
686
777
tree3.commit('commit two')
688
779
# Out of date lightweight checkout
689
rev = repo.get_revision(branch1.revision_history()[-1])
690
datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
780
rev = repo.get_revision(branch1.last_revision())
781
datestring_last = osutils.format_date(rev.timestamp, rev.timezone).encode('ascii')
691
782
out, err = self.run_bzr('info tree/lightcheckout --verbose')
692
783
self.assertEqualDiff(
693
"""Lightweight checkout (format: %s)
784
b"""Lightweight checkout (format: %s)
695
786
light checkout root: tree/lightcheckout
696
787
checkout of branch: repo/branch
725
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
726
format.repository_format.get_format_description(),
819
""" % (self._repo_strings, format.get_branch_format().get_format_description().encode('ascii'),
820
format.repository_format.get_format_description().encode('ascii'),
727
821
datestring_first, datestring_last,
729
self.assertEqual('', err)
823
self.assertEqual(b'', err)
731
825
# Show info about shared branch
732
826
out, err = self.run_bzr('info repo/branch --verbose')
733
827
self.assertEqualDiff(
734
"""Repository branch (format: dirstate or knit)
828
b"""Repository branch (format: dirstate or knit)
736
830
shared repository: repo
737
831
repository branch: repo/branch
752
""" % (format.get_branch_format().get_format_description(),
753
format.repository_format.get_format_description(),
849
""" % (format.get_branch_format().get_format_description().encode('ascii'),
850
format.repository_format.get_format_description().encode('ascii'),
754
851
datestring_first, datestring_last,
756
self.assertEqual('', err)
853
self.assertEqual(b'', err)
758
855
# Show info about repository with revisions
759
856
out, err = self.run_bzr('info -v repo')
760
857
self.assertEqualDiff(
761
"""Shared repository (format: dirstate or dirstate-tags or knit)
858
b"""Shared repository (format: dirstate or dirstate-tags or knit)
763
860
shared repository: repo
766
863
control: Meta directory format 1
771
871
""" % (format.repository_format.get_format_description(),
773
self.assertEqual('', err)
873
self.assertEqual(b'', err)
775
875
def test_info_shared_repository_with_trees(self):
776
format = bzrdir.format_registry.make_bzrdir('knit')
876
format = controldir.format_registry.make_controldir('knit')
777
877
transport = self.get_transport()
779
879
# Create shared repository with working trees
789
889
control: Meta directory format 1
792
895
Create working tree for new branches inside the repository.
796
""" % (format.repository_format.get_format_description(),
899
""" % (format.repository_format.get_format_description().encode('ascii'),
798
self.assertEqual('', err)
901
self.assertEqual(b'', err)
800
903
# Create two branches
801
repo.bzrdir.root_transport.mkdir('branch1')
802
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
904
repo.controldir.root_transport.mkdir('branch1')
905
branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
804
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
907
branch2 = branch1.controldir.sprout('repo/branch2').open_branch()
806
909
# Empty first branch
807
910
out, err = self.run_bzr('info repo/branch1 --verbose')
835
941
""" % (format.get_branch_format().get_format_description(),
836
942
format.repository_format.get_format_description(),
838
self.assertEqual('', err)
944
self.assertEqual(b'', err)
840
946
# Update first branch
841
947
self.build_tree(['repo/branch1/a'])
842
tree1 = branch1.bzrdir.open_workingtree()
948
tree1 = branch1.controldir.open_workingtree()
844
950
tree1.commit('commit one')
845
rev = repo.get_revision(branch1.revision_history()[0])
951
rev = repo.get_revision(branch1.last_revision())
846
952
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
847
953
out, err = self.run_bzr('info -v repo/branch1')
848
954
self.assertEqualDiff(
849
"""Repository tree (format: knit)
955
b"""Repository tree (format: knit)
851
957
shared repository: repo
852
958
repository branch: repo/branch1
879
988
format.repository_format.get_format_description(),
880
989
datestring_first, datestring_first,
882
self.assertEqual('', err)
991
self.assertEqual(b'', err)
884
993
# Out of date second branch
885
994
out, err = self.run_bzr('info repo/branch2 --verbose')
886
995
self.assertEqualDiff(
887
"""Repository tree (format: knit)
996
b"""Repository tree (format: knit)
889
998
shared repository: repo
890
999
repository branch: repo/branch2
916
1028
""" % (format.get_branch_format().get_format_description(),
917
1029
format.repository_format.get_format_description(),
919
self.assertEqual('', err)
1031
self.assertEqual(b'', err)
921
1033
# Update second branch
922
tree2 = branch2.bzrdir.open_workingtree()
1034
tree2 = branch2.controldir.open_workingtree()
923
1035
tree2.pull(branch1)
924
1036
out, err = self.run_bzr('info -v repo/branch2')
925
1037
self.assertEqualDiff(
926
"""Repository tree (format: knit)
1038
b"""Repository tree (format: knit)
928
1040
shared repository: repo
929
1041
repository branch: repo/branch2
959
1074
format.repository_format.get_format_description(),
960
1075
datestring_first, datestring_first,
962
self.assertEqual('', err)
1077
self.assertEqual(b'', err)
964
1079
# Show info about repository with revisions
965
1080
out, err = self.run_bzr('info -v repo')
966
1081
self.assertEqualDiff(
967
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1082
b"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
969
1084
shared repository: repo
998
1116
control: Meta directory format 1
1001
1122
Create working tree for new branches inside the repository.
1005
""" % (format.repository_format.get_format_description(),
1126
""" % (format.repository_format.get_format_description().encode('ascii'),
1007
self.assertEqual('', err)
1128
self.assertEqual(b'', err)
1009
1130
# Create branch in root of repository
1010
control = repo.bzrdir
1131
control = repo.controldir
1011
1132
branch = control.create_branch()
1012
1133
control.create_workingtree()
1013
1134
out, err = self.run_bzr('info -v repo')
1014
1135
self.assertEqualDiff(
1015
"""Repository tree (format: knit)
1136
b"""Repository tree (format: knit)
1017
1138
shared repository: repo
1018
1139
repository branch: repo
1041
""" % (format.get_branch_format().get_format_description(),
1042
format.repository_format.get_format_description(),
1165
""" % (format.get_branch_format().get_format_description().encode('ascii'),
1166
format.repository_format.get_format_description().encode('ascii'),
1044
self.assertEqual('', err)
1168
self.assertEqual(b'', err)
1046
1170
def test_info_repository_hook(self):
1047
format = bzrdir.format_registry.make_bzrdir('knit')
1171
format = controldir.format_registry.make_controldir('knit')
1048
1172
def repo_info(repo, stats, outf):
1049
outf.write("more info\n")
1173
outf.write(u"more info\n")
1050
1174
info.hooks.install_named_hook('repository', repo_info, None)
1051
1175
# Create shared repository with working trees
1052
1176
repo = self.make_repository('repo', shared=True, format=format)
1053
1177
out, err = self.run_bzr('info -v repo')
1054
1178
self.assertEqualDiff(
1055
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1179
b"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1057
1181
shared repository: repo
1060
1184
control: Meta directory format 1
1063
1190
Create working tree for new branches inside the repository.
1068
""" % (format.repository_format.get_format_description(),
1195
""" % (format.repository_format.get_format_description().encode('ascii'),
1070
self.assertEqual('', err)
1197
self.assertEqual(b'', err)
1199
def test_info_unshared_repository_with_colocated_branches(self):
1200
format = controldir.format_registry.make_controldir('development-colo')
1201
transport = self.get_transport()
1203
# Create unshared repository
1204
repo = self.make_repository('repo', shared=False, format=format)
1205
repo.set_make_working_trees(True)
1206
repo.controldir.create_branch(name='foo')
1207
out, err = self.run_bzr('info repo')
1208
self.assertEqualDiff(
1209
b"""Unshared repository with trees and colocated branches (format: development-colo)
1213
self.assertEqual(b'', err)
1072
1215
def assertCheckoutStatusOutput(self,
1073
1216
command_string, lco_tree, shared_repo=None,
1148
1291
extra_space = ''
1149
1292
if light_checkout:
1150
1293
tree_data = (" light checkout root: %s\n" %
1151
friendly_location(lco_tree.bzrdir.root_transport.base))
1294
friendly_location(lco_tree.controldir.root_transport.base))
1152
1295
extra_space = ' '
1153
1296
if lco_tree.branch.get_bound_location() is not None:
1154
1297
tree_data += ("%s checkout root: %s\n" % (extra_space,
1155
friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1298
friendly_location(lco_tree.branch.controldir.root_transport.base)))
1156
1299
if shared_repo is not None:
1157
1300
branch_data = (
1158
1301
" checkout of branch: %s\n"
1159
1302
" shared repository: %s\n" %
1160
(friendly_location(repo_branch.bzrdir.root_transport.base),
1161
friendly_location(shared_repo.bzrdir.root_transport.base)))
1303
(friendly_location(repo_branch.controldir.root_transport.base),
1304
friendly_location(shared_repo.controldir.root_transport.base)))
1162
1305
elif repo_branch is not None:
1163
1306
branch_data = (
1164
1307
"%s checkout of branch: %s\n" %
1166
friendly_location(repo_branch.bzrdir.root_transport.base)))
1309
friendly_location(repo_branch.controldir.root_transport.base)))
1168
1311
branch_data = (" checkout of branch: %s\n" %
1169
lco_tree.branch.bzrdir.root_transport.base)
1312
lco_tree.branch.controldir.root_transport.base)
1171
1314
if verbose >= 2:
1172
1315
verbose_info = ' 0 committers\n'
1216
1362
repo = self.make_repository('repo', shared=True,
1217
1363
format=bzrdir.BzrDirMetaFormat1())
1218
1364
repo.set_make_working_trees(False)
1219
repo.bzrdir.root_transport.mkdir('branch')
1220
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
format=bzrdir.BzrDirMetaFormat1())
1365
repo.controldir.root_transport.mkdir('branch')
1366
repo_branch = controldir.ControlDir.create_branch_convenience(
1367
'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1222
1368
# Do a heavy checkout
1223
1369
transport.mkdir('tree')
1224
1370
transport.mkdir('tree/checkout')
1225
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
format=bzrdir.BzrDirMetaFormat1())
1371
co_branch = controldir.ControlDir.create_branch_convenience(
1372
'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1227
1373
co_branch.bind(repo_branch)
1228
1374
# Do a light checkout of the heavy one
1229
1375
transport.mkdir('tree/lightcheckout')
1230
1376
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
branch.BranchReferenceFormat().initialize(lco_dir,
1232
target_branch=co_branch)
1377
lco_dir.set_branch_reference(co_branch)
1233
1378
lco_dir.create_workingtree()
1234
1379
lco_tree = lco_dir.open_workingtree()
1320
1465
lco_tree.branch.unlock()
1322
1467
if sys.platform == 'win32':
1323
self.knownFailure('Win32 cannot run "bzr info"'
1468
self.knownFailure('Win32 cannot run "brz info"'
1324
1469
' when the tree is locked.')
1326
def test_info_locking_oslocks(self):
1327
if sys.platform == "win32":
1328
self.skip("don't use oslocks on win32 in unix manner")
1329
# This test tests old (all-in-one, OS lock using) behaviour which
1330
# simply cannot work on windows (and is indeed why we changed our
1331
# design. As such, don't try to remove the thisFailsStrictLockCheck
1333
self.thisFailsStrictLockCheck()
1335
tree = self.make_branch_and_tree('branch',
1336
format=bzrdir.BzrDirFormat6())
1338
# Test all permutations of locking the working tree, branch and repository
1339
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1340
# implemented by raising NotImplementedError and get_physical_lock_status()
1341
# always returns false. This makes bzr info hide the lock status. (Olaf)
1345
out, err = self.run_bzr('info -v branch')
1346
self.assertEqualDiff(
1347
"""Standalone tree (format: weave)
1352
control: All-in-one format 6
1353
working tree: Working tree format 2
1354
branch: Branch format 4
1357
In the working tree:
1365
0 versioned subdirectories
1372
""" % ('branch', tree.branch.repository._format.get_format_description(),
1374
self.assertEqual('', err)
1377
out, err = self.run_bzr('info -v branch')
1378
self.assertEqualDiff(
1379
"""Standalone tree (format: weave)
1384
control: All-in-one format 6
1385
working tree: Working tree format 2
1386
branch: Branch format 4
1389
In the working tree:
1397
0 versioned subdirectories
1404
""" % ('branch', tree.branch.repository._format.get_format_description(),
1406
self.assertEqual('', err)
1409
1471
def test_info_stacked(self):
1410
1472
# We have a mainline
1411
1473
trunk_tree = self.make_branch_and_tree('mainline',
1413
1475
trunk_tree.commit('mainline')
1414
1476
# and a branch from it which is stacked
1415
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1477
new_dir = trunk_tree.controldir.sprout('newbranch', stacked=True)
1416
1478
out, err = self.run_bzr('info newbranch')
1417
1479
self.assertEqual(
1418
"""Standalone tree (format: 1.6)
1480
b"""Standalone tree (format: 1.6)
1420
1482
branch root: newbranch
1424
1486
stacked on: mainline
1426
1488
self.assertEqual("", err)
1490
def test_info_revinfo_optional(self):
1491
tree = self.make_branch_and_tree('.')
1492
def last_revision_info(self):
1493
raise errors.UnsupportedOperation(last_revision_info, self)
1495
branch.Branch, "last_revision_info", last_revision_info)
1496
out, err = self.run_bzr('info -v .')
1498
b"""Standalone tree (format: 2a)
1503
control: Meta directory format 1
1504
working tree: Working tree format 6
1505
branch: Branch format 7
1506
repository: Repository format 2a - rich roots, group compression and chk inventories
1511
In the working tree:
1519
0 versioned subdirectories
1521
self.assertEqual(b"", err)
1523
def test_info_shows_colocated_branches(self):
1524
bzrdir = self.make_branch('.', format='development-colo').controldir
1525
bzrdir.create_branch(name="colo1")
1526
bzrdir.create_branch(name="colo2")
1527
bzrdir.create_branch(name="colo3")
1528
out, err = self.run_bzr('info -v .')
1529
self.assertEqualDiff(
1530
"""Standalone branch (format: development-colo)
1535
control: Meta directory format 1 with support for colocated branches
1536
branch: Branch format 7
1537
repository: Repository format 2a - rich roots, group compression and chk inventories
1548
self.assertEqual(b"", err)
1551
class TestSmartServerInfo(tests.TestCaseWithTransport):
1553
def test_simple_branch_info(self):
1554
self.setup_smart_server_with_call_log()
1555
t = self.make_branch_and_tree('branch')
1556
self.build_tree_contents([('branch/foo', b'thecontents')])
1559
self.reset_smart_call_log()
1560
out, err = self.run_bzr(['info', self.get_url('branch')])
1561
# This figure represent the amount of work to perform this use case. It
1562
# is entirely ok to reduce this number if a test fails due to rpc_count
1563
# being too low. If rpc_count increases, more network roundtrips have
1564
# become necessary for this use case. Please do not adjust this number
1565
# upwards without agreement from bzr's network support maintainers.
1566
self.assertLength(10, self.hpss_calls)
1567
self.assertLength(1, self.hpss_connections)
1568
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1570
def test_verbose_branch_info(self):
1571
self.setup_smart_server_with_call_log()
1572
t = self.make_branch_and_tree('branch')
1573
self.build_tree_contents([('branch/foo', b'thecontents')])
1576
self.reset_smart_call_log()
1577
out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
1578
# This figure represent the amount of work to perform this use case. It
1579
# is entirely ok to reduce this number if a test fails due to rpc_count
1580
# being too low. If rpc_count increases, more network roundtrips have
1581
# become necessary for this use case. Please do not adjust this number
1582
# upwards without agreement from bzr's network support maintainers.
1583
self.assertLength(14, self.hpss_calls)
1584
self.assertLength(1, self.hpss_connections)
1585
self.assertThat(self.hpss_calls, ContainsNoVfsCalls)