1
# Copyright (C) 2006, 2007 Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
# GNU General Public License for more details.
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
"""Tests for the info command of bzr."""
27
from bzrlib.osutils import format_date
28
from bzrlib.tests import TestSkipped
29
from bzrlib.tests.blackbox import ExternalBase
32
class TestInfo(ExternalBase):
34
def test_info_non_existing(self):
35
if sys.platform == "win32":
36
location = "C:/i/do/not/exist/"
38
location = "/i/do/not/exist/"
39
out, err = self.runbzr('info '+location, retcode=3)
40
self.assertEqual(out, '')
41
self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
43
def test_info_standalone(self):
44
transport = self.get_transport()
46
# Create initial standalone branch
47
tree1 = self.make_branch_and_tree('standalone', 'weave')
48
self.build_tree(['standalone/a'])
50
branch1 = tree1.branch
51
out, err = self.runbzr('info standalone')
57
control: All-in-one format 6
58
working tree: Working tree format 2
59
branch: Branch format 4
60
repository: Weave repository format 6
70
0 versioned subdirectories
78
""" % branch1.bzrdir.root_transport.base, out)
79
self.assertEqual('', err)
80
tree1.commit('commit one')
81
rev = branch1.repository.get_revision(branch1.revision_history()[0])
82
datestring_first = format_date(rev.timestamp, rev.timezone)
84
# Branch standalone with push location
85
branch2 = branch1.bzrdir.sprout('branch').open_branch()
86
branch2.set_push_location(branch1.bzrdir.root_transport.base)
87
out, err = self.runbzr('info branch --verbose')
97
control: All-in-one format 6
98
working tree: Working tree format 2
99
branch: Branch format 4
100
repository: Weave repository format 6
110
0 versioned subdirectories
122
""" % (branch2.bzrdir.root_transport.base,
123
branch1.bzrdir.root_transport.base,
124
branch1.bzrdir.root_transport.base,
125
datestring_first, datestring_first,
126
# poking at _revision_store isn't all that clean, but neither is
127
# having the ui test dependent on the exact overhead of a given store.
128
branch2.repository._revision_store.total_size(
129
branch2.repository.get_transaction())[1] / 1024,
131
self.assertEqual('', err)
133
# Branch and bind to standalone, needs upgrade to metadir
134
# (creates backup as unknown)
135
branch1.bzrdir.sprout('bound')
136
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
137
bzrlib.upgrade.upgrade('bound', knit1_format)
138
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
139
branch3.bind(branch1)
140
bound_tree = branch3.bzrdir.open_workingtree()
141
out, err = self.runbzr('info bound')
142
self.assertEqualDiff(
145
checkout of branch: %s
151
control: Meta directory format 1
164
0 versioned subdirectories
175
""" % (branch3.bzrdir.root_transport.base,
176
branch1.bzrdir.root_transport.base,
177
branch1.bzrdir.root_transport.base,
178
bound_tree._format.get_format_description(),
179
branch3._format.get_format_description(),
180
branch3.repository._format.get_format_description(),
181
datestring_first, datestring_first,
182
# poking at _revision_store isn't all that clean, but neither is
183
# having the ui test dependent on the exact overhead of a given store.
184
branch3.repository._revision_store.total_size(
185
branch3.repository.get_transaction())[1] / 1024,
187
self.assertEqual('', err)
189
# Checkout standalone (same as above, but does not have parent set)
190
branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
192
branch4.bind(branch1)
193
branch4.bzrdir.open_workingtree().update()
194
out, err = self.runbzr('info checkout --verbose')
195
self.assertEqualDiff(
198
checkout of branch: %s
201
control: Meta directory format 1
202
working tree: Working tree format 3
203
branch: Branch format 5
214
0 versioned subdirectories
226
""" % (branch4.bzrdir.root_transport.base,
227
branch1.bzrdir.root_transport.base,
228
branch4.repository._format.get_format_description(),
229
datestring_first, datestring_first,
230
# poking at _revision_store isn't all that clean, but neither is
231
# having the ui test dependent on the exact overhead of a given store.
232
branch4.repository._revision_store.total_size(
233
branch4.repository.get_transaction())[1] / 1024,
235
self.assertEqual('', err)
237
# Lightweight checkout (same as above, different branch and repository)
238
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
239
branch5 = tree5.branch
240
out, err = self.runbzr('info lightcheckout')
241
self.assertEqualDiff(
243
light checkout root: %s
244
checkout of branch: %s
247
control: Meta directory format 1
248
working tree: Working tree format 4
249
branch: Branch format 4
250
repository: Weave repository format 6
260
0 versioned subdirectories
271
""" % (tree5.bzrdir.root_transport.base,
272
branch1.bzrdir.root_transport.base,
273
datestring_first, datestring_first,
275
self.assertEqual('', err)
277
# Update initial standalone branch
278
self.build_tree(['standalone/b'])
280
tree1.commit('commit two')
281
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
282
datestring_last = format_date(rev.timestamp, rev.timezone)
284
# Out of date branched standalone branch will not be detected
285
out, err = self.runbzr('info branch')
286
self.assertEqualDiff(
292
publish to branch: %s
295
control: All-in-one format 6
296
working tree: Working tree format 2
297
branch: Branch format 4
298
repository: Weave repository format 6
308
0 versioned subdirectories
319
""" % (branch2.bzrdir.root_transport.base,
320
branch1.bzrdir.root_transport.base,
321
branch1.bzrdir.root_transport.base,
322
datestring_first, datestring_first,
324
self.assertEqual('', err)
326
# Out of date bound branch
327
out, err = self.runbzr('info bound')
328
self.assertEqualDiff(
331
checkout of branch: %s
337
control: Meta directory format 1
338
working tree: Working tree format 3
339
branch: Branch format 5
342
Branch is out of date: missing 1 revision.
352
0 versioned subdirectories
363
""" % (branch3.bzrdir.root_transport.base,
364
branch1.bzrdir.root_transport.base,
365
branch1.bzrdir.root_transport.base,
366
branch3.repository._format.get_format_description(),
367
datestring_first, datestring_first,
368
# poking at _revision_store isn't all that clean, but neither is
369
# having the ui test dependent on the exact overhead of a given store.
370
branch3.repository._revision_store.total_size(
371
branch3.repository.get_transaction())[1] / 1024,
373
self.assertEqual('', err)
375
# Out of date checkout
376
out, err = self.runbzr('info checkout')
377
self.assertEqualDiff(
380
checkout of branch: %s
383
control: Meta directory format 1
384
working tree: Working tree format 3
385
branch: Branch format 5
388
Branch is out of date: missing 1 revision.
398
0 versioned subdirectories
409
""" % (branch4.bzrdir.root_transport.base,
410
branch1.bzrdir.root_transport.base,
411
branch4.repository._format.get_format_description(),
412
datestring_first, datestring_first,
413
# poking at _revision_store isn't all that clean, but neither is
414
# having the ui test dependent on the exact overhead of a given store.
415
branch4.repository._revision_store.total_size(
416
branch4.repository.get_transaction())[1] / 1024,
418
self.assertEqual('', err)
420
# Out of date lightweight checkout
421
out, err = self.runbzr('info lightcheckout --verbose')
422
self.assertEqualDiff(
424
light checkout root: %s
425
checkout of branch: %s
428
control: Meta directory format 1
429
working tree: Working tree format 4
430
branch: Branch format 4
431
repository: Weave repository format 6
433
Working tree is out of date: missing 1 revision.
443
0 versioned subdirectories
455
""" % (tree5.bzrdir.root_transport.base,
456
branch1.bzrdir.root_transport.base,
457
datestring_first, datestring_last,
459
self.assertEqual('', err)
461
def test_info_standalone_no_tree(self):
462
# create standalone branch without a working tree
463
format = bzrdir.format_registry.make_bzrdir('default')
464
branch = self.make_branch('branch')
465
repo = branch.repository
466
out, err = self.runbzr('info branch')
467
self.assertEqualDiff(
472
control: Meta directory format 1
482
""" % (branch.bzrdir.root_transport.base,
483
format.get_branch_format().get_format_description(),
484
format.repository_format.get_format_description(),
486
self.assertEqual('', err)
488
def test_info_shared_repository(self):
489
format = bzrdir.format_registry.make_bzrdir('knit')
490
transport = self.get_transport()
492
# Create shared repository
493
repo = self.make_repository('repo', shared=True, format=format)
494
repo.set_make_working_trees(False)
495
out, err = self.runbzr('info repo')
496
self.assertEqualDiff(
498
shared repository: %s
501
control: Meta directory format 1
507
""" % (repo.bzrdir.root_transport.base,
508
format.repository_format.get_format_description(),
510
self.assertEqual('', err)
512
# Create branch inside shared repository
513
repo.bzrdir.root_transport.mkdir('branch')
514
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
516
out, err = self.runbzr('info repo/branch')
517
self.assertEqualDiff(
519
shared repository: %s
520
repository branch: branch
523
control: Meta directory format 1
533
""" % (repo.bzrdir.root_transport.base,
534
format.get_branch_format().get_format_description(),
535
format.repository_format.get_format_description(),
537
self.assertEqual('', err)
539
# Create lightweight checkout
540
transport.mkdir('tree')
541
transport.mkdir('tree/lightcheckout')
542
tree2 = branch1.create_checkout('tree/lightcheckout',
544
branch2 = tree2.branch
545
self.assertCheckoutStatusOutput('tree/lightcheckout', tree2,
548
# Create normal checkout
549
tree3 = branch1.create_checkout('tree/checkout')
550
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
552
light_checkout=False, repo_branch=branch1)
553
# Update lightweight checkout
554
self.build_tree(['tree/lightcheckout/a'])
556
tree2.commit('commit one')
557
rev = repo.get_revision(branch2.revision_history()[0])
558
datestring_first = format_date(rev.timestamp, rev.timezone)
559
out, err = self.runbzr('info tree/lightcheckout --verbose')
560
self.assertEqualDiff(
562
light checkout root: %s
563
shared repository: %s
564
repository branch: branch
567
control: Meta directory format 1
568
working tree: Working tree format 4
580
0 versioned subdirectories
592
""" % (tree2.bzrdir.root_transport.base,
593
repo.bzrdir.root_transport.base,
594
format.get_branch_format().get_format_description(),
595
format.repository_format.get_format_description(),
596
datestring_first, datestring_first,
597
# poking at _revision_store isn't all that clean, but neither is
598
# having the ui test dependent on the exact overhead of a given store.
599
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
601
self.assertEqual('', err)
603
# Out of date checkout
604
out, err = self.runbzr('info tree/checkout')
605
self.assertEqualDiff(
608
checkout of branch: %s
611
control: Meta directory format 1
612
working tree: Working tree format 4
616
Branch is out of date: missing 1 revision.
626
0 versioned subdirectories
634
""" % (tree3.bzrdir.root_transport.base,
635
branch1.bzrdir.root_transport.base,
636
format.get_branch_format().get_format_description(),
637
format.repository_format.get_format_description(),
639
self.assertEqual('', err)
643
self.build_tree(['tree/checkout/b'])
645
out, err = self.runbzr('info tree/checkout --verbose')
646
self.assertEqualDiff(
649
checkout of branch: %s
652
control: Meta directory format 1
653
working tree: Working tree format 4
665
0 versioned subdirectories
677
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
678
format.get_branch_format().get_format_description(),
679
format.repository_format.get_format_description(),
680
datestring_first, datestring_first,
681
# poking at _revision_store isn't all that clean, but neither is
682
# having the ui test dependent on the exact overhead of a given store.
683
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
685
self.assertEqual('', err)
686
tree3.commit('commit two')
688
# Out of date lightweight checkout
689
rev = repo.get_revision(branch1.revision_history()[-1])
690
datestring_last = format_date(rev.timestamp, rev.timezone)
691
out, err = self.runbzr('info tree/lightcheckout --verbose')
692
self.assertEqualDiff(
694
light checkout root: %s
695
shared repository: %s
696
repository branch: branch
699
control: Meta directory format 1
700
working tree: Working tree format 4
704
Working tree is out of date: missing 1 revision.
714
0 versioned subdirectories
726
""" % (tree2.bzrdir.root_transport.base,
727
repo.bzrdir.root_transport.base,
728
format.get_branch_format().get_format_description(),
729
format.repository_format.get_format_description(),
730
datestring_first, datestring_last,
731
# poking at _revision_store isn't all that clean, but neither is
732
# having the ui test dependent on the exact overhead of a given store.
733
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
735
self.assertEqual('', err)
737
# Show info about shared branch
738
out, err = self.runbzr('info repo/branch --verbose')
739
self.assertEqualDiff(
741
shared repository: %s
742
repository branch: branch
745
control: Meta directory format 1
759
""" % (repo.bzrdir.root_transport.base,
760
format.get_branch_format().get_format_description(),
761
format.repository_format.get_format_description(),
762
datestring_first, datestring_last,
763
# poking at _revision_store isn't all that clean, but neither is
764
# having the ui test dependent on the exact overhead of a given store.
765
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
767
self.assertEqual('', err)
769
# Show info about repository with revisions
770
out, err = self.runbzr('info repo')
771
self.assertEqualDiff(
773
shared repository: %s
776
control: Meta directory format 1
782
""" % (repo.bzrdir.root_transport.base,
783
format.repository_format.get_format_description(),
784
# poking at _revision_store isn't all that clean, but neither is
785
# having the ui test dependent on the exact overhead of a given store.
786
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
788
self.assertEqual('', err)
790
def test_info_shared_repository_with_trees(self):
791
format = bzrdir.format_registry.make_bzrdir('knit')
792
transport = self.get_transport()
794
# Create shared repository with working trees
795
repo = self.make_repository('repo', shared=True, format=format)
796
repo.set_make_working_trees(True)
797
out, err = self.runbzr('info repo')
798
self.assertEqualDiff(
800
shared repository: %s
803
control: Meta directory format 1
806
Create working tree for new branches inside the repository.
811
""" % (repo.bzrdir.root_transport.base,
812
format.repository_format.get_format_description(),
814
self.assertEqual('', err)
816
# Create two branches
817
repo.bzrdir.root_transport.mkdir('branch1')
818
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
820
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
823
out, err = self.runbzr('info repo/branch1 --verbose')
824
self.assertEqualDiff(
826
shared repository: %s
827
repository checkout: branch1
830
control: Meta directory format 1
831
working tree: Working tree format 3
843
0 versioned subdirectories
852
""" % (repo.bzrdir.root_transport.base,
853
format.get_branch_format().get_format_description(),
854
format.repository_format.get_format_description(),
856
self.assertEqual('', err)
858
# Update first branch
859
self.build_tree(['repo/branch1/a'])
860
tree1 = branch1.bzrdir.open_workingtree()
862
tree1.commit('commit one')
863
rev = repo.get_revision(branch1.revision_history()[0])
864
datestring_first = format_date(rev.timestamp, rev.timezone)
865
out, err = self.runbzr('info repo/branch1')
866
self.assertEqualDiff(
868
shared repository: %s
869
repository checkout: branch1
872
control: Meta directory format 1
873
working tree: Working tree format 3
885
0 versioned subdirectories
896
""" % (repo.bzrdir.root_transport.base,
897
format.get_branch_format().get_format_description(),
898
format.repository_format.get_format_description(),
899
datestring_first, datestring_first,
900
# poking at _revision_store isn't all that clean, but neither is
901
# having the ui test dependent on the exact overhead of a given store.
902
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
904
self.assertEqual('', err)
906
# Out of date second branch
907
out, err = self.runbzr('info repo/branch2 --verbose')
908
self.assertEqualDiff(
910
shared repository: %s
911
repository checkout: branch2
917
control: Meta directory format 1
918
working tree: Working tree format 3
930
0 versioned subdirectories
939
""" % (repo.bzrdir.root_transport.base,
940
branch1.bzrdir.root_transport.base,
941
format.get_branch_format().get_format_description(),
942
format.repository_format.get_format_description(),
943
# poking at _revision_store isn't all that clean, but neither is
944
# having the ui test dependent on the exact overhead of a given store.
945
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
947
self.assertEqual('', err)
949
# Update second branch
950
tree2 = branch2.bzrdir.open_workingtree()
952
out, err = self.runbzr('info repo/branch2')
953
self.assertEqualDiff(
955
shared repository: %s
956
repository checkout: branch2
962
control: Meta directory format 1
963
working tree: Working tree format 3
975
0 versioned subdirectories
986
""" % (repo.bzrdir.root_transport.base,
987
branch1.bzrdir.root_transport.base,
988
format.get_branch_format().get_format_description(),
989
format.repository_format.get_format_description(),
990
datestring_first, datestring_first,
991
# poking at _revision_store isn't all that clean, but neither is
992
# having the ui test dependent on the exact overhead of a given store.
993
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
995
self.assertEqual('', err)
997
# Show info about repository with revisions
998
out, err = self.runbzr('info repo')
999
self.assertEqualDiff(
1001
shared repository: %s
1004
control: Meta directory format 1
1007
Create working tree for new branches inside the repository.
1012
""" % (repo.bzrdir.root_transport.base,
1013
format.repository_format.get_format_description(),
1014
# poking at _revision_store isn't all that clean, but neither is
1015
# having the ui test dependent on the exact overhead of a given store.
1016
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1019
self.assertEqual('', err)
1021
def test_info_shared_repository_with_tree_in_root(self):
1022
format = bzrdir.format_registry.make_bzrdir('knit')
1023
transport = self.get_transport()
1025
# Create shared repository with working trees
1026
repo = self.make_repository('repo', shared=True, format=format)
1027
repo.set_make_working_trees(True)
1028
out, err = self.runbzr('info repo')
1029
self.assertEqualDiff(
1031
shared repository: %s
1034
control: Meta directory format 1
1037
Create working tree for new branches inside the repository.
1042
""" % (repo.bzrdir.root_transport.base,
1043
format.repository_format.get_format_description(),
1045
self.assertEqual('', err)
1047
# Create branch in root of repository
1048
control = repo.bzrdir
1049
branch = control.create_branch()
1050
control.create_workingtree()
1051
out, err = self.runbzr('info repo')
1052
self.assertEqualDiff(
1054
shared repository: %s
1055
repository checkout: .
1058
control: Meta directory format 1
1059
working tree: Working tree format 3
1063
In the working tree:
1071
0 versioned subdirectories
1079
""" % (repo.bzrdir.root_transport.base,
1080
format.get_branch_format().get_format_description(),
1081
format.repository_format.get_format_description(),
1083
self.assertEqual('', err)
1085
def assertCheckoutStatusOutput(self,
1086
command_string, lco_tree, shared_repo=None,
1089
branch_locked=False, repo_locked=False,
1091
light_checkout=True):
1092
"""Check the output of info in a light checkout tree.
1094
This is not quite a mirror of the info code: rather than using the
1095
tree being examined to predict output, it uses a bunch of flags which
1096
allow us, the test writers, to document what *should* be present in
1097
the output. Removing this separation would remove the value of the
1100
:param path: the path to the light checkout.
1101
:param lco_tree: the tree object for the light checkout.
1102
:param shared_repo: A shared repository is in use, expect that in
1104
:param repo_branch: A branch in a shared repository for non light
1106
:param tree_locked: If true, expect the tree to be locked.
1107
:param branch_locked: If true, expect the branch to be locked.
1108
:param repo_locked: If true, expect the repository to be locked.
1109
:param verbose: If true, expect verbose output
1111
out, err = self.runbzr('info %s' % command_string)
1112
if repo_locked or branch_locked or tree_locked:
1113
def locked_message(a_bool):
1118
expected_lock_output = (
1121
" working tree: %s\n"
1123
" repository: %s\n" % (
1124
locked_message(tree_locked),
1125
locked_message(branch_locked),
1126
locked_message(repo_locked)))
1128
expected_lock_output = ''
1130
tree_data = (" light checkout root: %s" %
1131
lco_tree.bzrdir.root_transport.base)
1133
tree_data = (" checkout root: %s" %
1134
lco_tree.bzrdir.root_transport.base)
1135
if shared_repo is not None:
1137
" shared repository: %s\n"
1138
" repository branch: branch\n" %
1139
shared_repo.bzrdir.root_transport.base)
1140
elif repo_branch is not None:
1142
" checkout of branch: %s\n" %
1143
repo_branch.bzrdir.root_transport.base)
1145
branch_data = (" checkout of branch: %s\n" %
1146
lco_tree.branch.bzrdir.root_transport.base)
1149
verbose_info = ' 0 committers\n'
1153
self.assertEqualDiff(
1158
control: Meta directory format 1
1163
In the working tree:
1171
0 versioned subdirectories
1181
lco_tree._format.get_format_description(),
1182
lco_tree.branch._format.get_format_description(),
1183
lco_tree.branch.repository._format.get_format_description(),
1184
expected_lock_output,
1187
self.assertEqual('', err)
1189
def test_info_locking(self):
1190
transport = self.get_transport()
1191
# Create shared repository with a branch
1192
repo = self.make_repository('repo', shared=True,
1193
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1194
repo.set_make_working_trees(False)
1195
repo.bzrdir.root_transport.mkdir('branch')
1196
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1197
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1198
# Do a heavy checkout
1199
transport.mkdir('tree')
1200
transport.mkdir('tree/checkout')
1201
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1202
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1203
co_branch.bind(repo_branch)
1204
# Do a light checkout of the heavy one
1205
transport.mkdir('tree/lightcheckout')
1206
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1207
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1208
lco_dir.create_workingtree()
1209
lco_tree = lco_dir.open_workingtree()
1211
# Test all permutations of locking the working tree, branch and repository
1215
self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
1217
lco_tree.branch.repository.lock_write()
1219
self.assertCheckoutStatusOutput('tree/lightcheckout',
1223
lco_tree.branch.repository.unlock()
1225
lco_tree.branch.lock_write()
1227
self.assertCheckoutStatusOutput('tree/lightcheckout',
1232
lco_tree.branch.unlock()
1234
lco_tree.lock_write()
1236
self.assertCheckoutStatusOutput('tree/lightcheckout',
1244
lco_tree.lock_write()
1245
lco_tree.branch.repository.unlock()
1247
self.assertCheckoutStatusOutput('tree/lightcheckout',
1252
lco_tree.branch.repository.lock_write()
1255
lco_tree.lock_write()
1256
lco_tree.branch.unlock()
1258
self.assertCheckoutStatusOutput('tree/lightcheckout',
1262
lco_tree.branch.lock_write()
1265
lco_tree.lock_write()
1266
lco_tree.branch.unlock()
1267
lco_tree.branch.repository.lock_write()
1269
self.assertCheckoutStatusOutput('tree/lightcheckout',
1274
lco_tree.branch.repository.unlock()
1275
lco_tree.branch.lock_write()
1278
lco_tree.branch.lock_write()
1279
lco_tree.branch.repository.unlock()
1281
self.assertCheckoutStatusOutput('tree/lightcheckout',
1285
lco_tree.branch.repository.lock_write()
1286
lco_tree.branch.unlock()
1288
def test_info_locking_oslocks(self):
1289
if sys.platform == "win32":
1290
raise TestSkipped("don't use oslocks on win32 in unix manner")
1292
tree = self.make_branch_and_tree('branch',
1293
format=bzrlib.bzrdir.BzrDirFormat6())
1295
# Test all permutations of locking the working tree, branch and repository
1296
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1297
# implemented by raising NotImplementedError and get_physical_lock_status()
1298
# always returns false. This makes bzr info hide the lock status. (Olaf)
1302
out, err = self.runbzr('info branch')
1303
self.assertEqualDiff(
1308
control: All-in-one format 6
1309
working tree: Working tree format 2
1310
branch: Branch format 4
1313
In the working tree:
1321
0 versioned subdirectories
1329
""" % (tree.bzrdir.root_transport.base,
1330
tree.branch.repository._format.get_format_description(),
1332
self.assertEqual('', err)
1335
out, err = self.runbzr('info branch')
1336
self.assertEqualDiff(
1341
control: All-in-one format 6
1342
working tree: Working tree format 2
1343
branch: Branch format 4
1346
In the working tree:
1354
0 versioned subdirectories
1362
""" % (tree.bzrdir.root_transport.base,
1363
tree.branch.repository._format.get_format_description(),
1365
self.assertEqual('', err)