1
# Copyright (C) 2006 Canonical Ltd
2
# -*- coding: utf-8 -*-
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
"""Tests for the info command of bzr."""
28
from bzrlib.osutils import format_date
29
from bzrlib.tests import TestSkipped
30
from bzrlib.tests.blackbox import ExternalBase
33
class TestInfo(ExternalBase):
35
def test_info_non_existing(self):
36
if sys.platform == "win32":
37
location = "C:/i/do/not/exist/"
39
location = "/i/do/not/exist/"
40
out, err = self.runbzr('info '+location, retcode=3)
41
self.assertEqual(out, '')
42
self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
44
def test_info_standalone(self):
45
transport = self.get_transport()
47
# Create initial standalone branch
48
tree1 = self.make_branch_and_tree('standalone', 'weave')
49
self.build_tree(['standalone/a'])
51
branch1 = tree1.branch
52
out, err = self.runbzr('info standalone')
58
control: All-in-one format 6
59
working tree: Working tree format 2
60
branch: Branch format 4
61
repository: Weave repository format 6
71
0 versioned subdirectories
79
""" % branch1.bzrdir.root_transport.base, out)
80
self.assertEqual('', err)
81
tree1.commit('commit one')
82
rev = branch1.repository.get_revision(branch1.revision_history()[0])
83
datestring_first = format_date(rev.timestamp, rev.timezone)
85
# Branch standalone with push location
86
branch2 = branch1.bzrdir.sprout('branch').open_branch()
87
branch2.set_push_location(branch1.bzrdir.root_transport.base)
88
out, err = self.runbzr('info branch --verbose')
98
control: All-in-one format 6
99
working tree: Working tree format 2
100
branch: Branch format 4
101
repository: Weave repository format 6
111
0 versioned subdirectories
123
""" % (branch2.bzrdir.root_transport.base,
124
branch1.bzrdir.root_transport.base,
125
branch1.bzrdir.root_transport.base,
126
datestring_first, datestring_first,
127
# poking at _revision_store isn't all that clean, but neither is
128
# having the ui test dependent on the exact overhead of a given store.
129
branch2.repository._revision_store.total_size(
130
branch2.repository.get_transaction())[1] / 1024,
132
self.assertEqual('', err)
134
# Branch and bind to standalone, needs upgrade to metadir
135
# (creates backup as unknown)
136
branch1.bzrdir.sprout('bound')
137
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
138
bzrlib.upgrade.upgrade('bound', knit1_format)
139
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
140
branch3.bind(branch1)
141
bound_tree = branch3.bzrdir.open_workingtree()
142
out, err = self.runbzr('info bound')
143
self.assertEqualDiff(
146
checkout of branch: %s
152
control: Meta directory format 1
154
branch: Branch format 5
165
0 versioned subdirectories
176
""" % (branch3.bzrdir.root_transport.base,
177
branch1.bzrdir.root_transport.base,
178
branch1.bzrdir.root_transport.base,
179
bound_tree._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 3
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 3
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
473
branch: Branch format 5
482
""" % (branch.bzrdir.root_transport.base,
483
format.repository_format.get_format_description(),
485
self.assertEqual('', err)
487
def test_info_shared_repository(self):
488
format = bzrdir.format_registry.make_bzrdir('metaweave')
489
transport = self.get_transport()
491
# Create shared repository
492
repo = self.make_repository('repo', shared=True, format=format)
493
repo.set_make_working_trees(False)
494
out, err = self.runbzr('info repo')
495
self.assertEqualDiff(
497
shared repository: %s
500
control: Meta directory format 1
506
""" % (repo.bzrdir.root_transport.base,
507
format.repository_format.get_format_description(),
509
self.assertEqual('', err)
511
# Create branch inside shared repository
512
repo.bzrdir.root_transport.mkdir('branch')
513
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
515
out, err = self.runbzr('info repo/branch')
516
self.assertEqualDiff(
518
shared repository: %s
519
repository branch: branch
522
control: Meta directory format 1
523
branch: Branch format 5
532
""" % (repo.bzrdir.root_transport.base,
533
format.repository_format.get_format_description(),
535
self.assertEqual('', err)
537
# Create lightweight checkout
538
transport.mkdir('tree')
539
transport.mkdir('tree/lightcheckout')
540
tree2 = branch1.create_checkout('tree/lightcheckout',
542
branch2 = tree2.branch
543
self.assertCheckoutStatusOutput('tree/lightcheckout', tree2,
546
# Create normal checkout
547
tree3 = branch1.create_checkout('tree/checkout')
548
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
550
light_checkout=False, repo_branch=branch1)
551
# Update lightweight checkout
552
self.build_tree(['tree/lightcheckout/a'])
554
tree2.commit('commit one')
555
rev = repo.get_revision(branch2.revision_history()[0])
556
datestring_first = format_date(rev.timestamp, rev.timezone)
557
out, err = self.runbzr('info tree/lightcheckout --verbose')
558
self.assertEqualDiff(
560
light checkout root: %s
561
shared repository: %s
562
repository branch: branch
565
control: Meta directory format 1
566
working tree: Working tree format 3
567
branch: Branch format 5
578
0 versioned subdirectories
590
""" % (tree2.bzrdir.root_transport.base,
591
repo.bzrdir.root_transport.base,
592
format.repository_format.get_format_description(),
593
datestring_first, datestring_first,
594
# poking at _revision_store isn't all that clean, but neither is
595
# having the ui test dependent on the exact overhead of a given store.
596
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
598
self.assertEqual('', err)
600
# Out of date checkout
601
out, err = self.runbzr('info tree/checkout')
602
self.assertEqualDiff(
605
checkout of branch: %s
608
control: Meta directory format 1
609
working tree: Working tree format 3
610
branch: Branch format 5
613
Branch is out of date: missing 1 revision.
623
0 versioned subdirectories
631
""" % (tree3.bzrdir.root_transport.base,
632
branch1.bzrdir.root_transport.base,
633
format.repository_format.get_format_description(),
635
self.assertEqual('', err)
639
self.build_tree(['tree/checkout/b'])
641
out, err = self.runbzr('info tree/checkout --verbose')
642
self.assertEqualDiff(
645
checkout of branch: %s
648
control: Meta directory format 1
649
working tree: Working tree format 3
650
branch: Branch format 5
661
0 versioned subdirectories
673
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
674
format.repository_format.get_format_description(),
675
datestring_first, datestring_first,
676
# poking at _revision_store isn't all that clean, but neither is
677
# having the ui test dependent on the exact overhead of a given store.
678
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
680
self.assertEqual('', err)
681
tree3.commit('commit two')
683
# Out of date lightweight checkout
684
rev = repo.get_revision(branch1.revision_history()[-1])
685
datestring_last = format_date(rev.timestamp, rev.timezone)
686
out, err = self.runbzr('info tree/lightcheckout --verbose')
687
self.assertEqualDiff(
689
light checkout root: %s
690
shared repository: %s
691
repository branch: branch
694
control: Meta directory format 1
695
working tree: Working tree format 3
696
branch: Branch format 5
699
Working tree is out of date: missing 1 revision.
709
0 versioned subdirectories
721
""" % (tree2.bzrdir.root_transport.base,
722
repo.bzrdir.root_transport.base,
723
format.repository_format.get_format_description(),
724
datestring_first, datestring_last,
725
# poking at _revision_store isn't all that clean, but neither is
726
# having the ui test dependent on the exact overhead of a given store.
727
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
729
self.assertEqual('', err)
731
# Show info about shared branch
732
out, err = self.runbzr('info repo/branch --verbose')
733
self.assertEqualDiff(
735
shared repository: %s
736
repository branch: branch
739
control: Meta directory format 1
740
branch: Branch format 5
753
""" % (repo.bzrdir.root_transport.base,
754
format.repository_format.get_format_description(),
755
datestring_first, datestring_last,
756
# poking at _revision_store isn't all that clean, but neither is
757
# having the ui test dependent on the exact overhead of a given store.
758
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
760
self.assertEqual('', err)
762
# Show info about repository with revisions
763
out, err = self.runbzr('info repo')
764
self.assertEqualDiff(
766
shared repository: %s
769
control: Meta directory format 1
775
""" % (repo.bzrdir.root_transport.base,
776
format.repository_format.get_format_description(),
777
# poking at _revision_store isn't all that clean, but neither is
778
# having the ui test dependent on the exact overhead of a given store.
779
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
781
self.assertEqual('', err)
783
def test_info_shared_repository_with_trees(self):
784
format = bzrdir.format_registry.make_bzrdir('metaweave')
785
transport = self.get_transport()
787
# Create shared repository with working trees
788
repo = self.make_repository('repo', shared=True, format=format)
789
repo.set_make_working_trees(True)
790
out, err = self.runbzr('info repo')
791
self.assertEqualDiff(
793
shared repository: %s
796
control: Meta directory format 1
799
Create working tree for new branches inside the repository.
804
""" % (repo.bzrdir.root_transport.base,
805
format.repository_format.get_format_description(),
807
self.assertEqual('', err)
809
# Create two branches
810
repo.bzrdir.root_transport.mkdir('branch1')
811
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
813
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
816
out, err = self.runbzr('info repo/branch1 --verbose')
817
self.assertEqualDiff(
819
shared repository: %s
820
repository checkout: branch1
823
control: Meta directory format 1
824
working tree: Working tree format 3
825
branch: Branch format 5
836
0 versioned subdirectories
845
""" % (repo.bzrdir.root_transport.base,
846
format.repository_format.get_format_description(),
848
self.assertEqual('', err)
850
# Update first branch
851
self.build_tree(['repo/branch1/a'])
852
tree1 = branch1.bzrdir.open_workingtree()
854
tree1.commit('commit one')
855
rev = repo.get_revision(branch1.revision_history()[0])
856
datestring_first = format_date(rev.timestamp, rev.timezone)
857
out, err = self.runbzr('info repo/branch1')
858
self.assertEqualDiff(
860
shared repository: %s
861
repository checkout: branch1
864
control: Meta directory format 1
865
working tree: Working tree format 3
866
branch: Branch format 5
877
0 versioned subdirectories
888
""" % (repo.bzrdir.root_transport.base,
889
format.repository_format.get_format_description(),
890
datestring_first, datestring_first,
891
# poking at _revision_store isn't all that clean, but neither is
892
# having the ui test dependent on the exact overhead of a given store.
893
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
895
self.assertEqual('', err)
897
# Out of date second branch
898
out, err = self.runbzr('info repo/branch2 --verbose')
899
self.assertEqualDiff(
901
shared repository: %s
902
repository checkout: branch2
908
control: Meta directory format 1
909
working tree: Working tree format 3
910
branch: Branch format 5
921
0 versioned subdirectories
930
""" % (repo.bzrdir.root_transport.base,
931
branch1.bzrdir.root_transport.base,
932
format.repository_format.get_format_description(),
933
# poking at _revision_store isn't all that clean, but neither is
934
# having the ui test dependent on the exact overhead of a given store.
935
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
937
self.assertEqual('', err)
939
# Update second branch
940
tree2 = branch2.bzrdir.open_workingtree()
942
out, err = self.runbzr('info repo/branch2')
943
self.assertEqualDiff(
945
shared repository: %s
946
repository checkout: branch2
952
control: Meta directory format 1
953
working tree: Working tree format 3
954
branch: Branch format 5
965
0 versioned subdirectories
976
""" % (repo.bzrdir.root_transport.base,
977
branch1.bzrdir.root_transport.base,
978
format.repository_format.get_format_description(),
979
datestring_first, datestring_first,
980
# poking at _revision_store isn't all that clean, but neither is
981
# having the ui test dependent on the exact overhead of a given store.
982
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
984
self.assertEqual('', err)
986
# Show info about repository with revisions
987
out, err = self.runbzr('info repo')
988
self.assertEqualDiff(
990
shared repository: %s
993
control: Meta directory format 1
996
Create working tree for new branches inside the repository.
1001
""" % (repo.bzrdir.root_transport.base,
1002
format.repository_format.get_format_description(),
1003
# poking at _revision_store isn't all that clean, but neither is
1004
# having the ui test dependent on the exact overhead of a given store.
1005
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1008
self.assertEqual('', err)
1010
def test_info_shared_repository_with_tree_in_root(self):
1011
format = bzrdir.format_registry.make_bzrdir('metaweave')
1012
transport = self.get_transport()
1014
# Create shared repository with working trees
1015
repo = self.make_repository('repo', shared=True, format=format)
1016
repo.set_make_working_trees(True)
1017
out, err = self.runbzr('info repo')
1018
self.assertEqualDiff(
1020
shared repository: %s
1023
control: Meta directory format 1
1026
Create working tree for new branches inside the repository.
1031
""" % (repo.bzrdir.root_transport.base,
1032
format.repository_format.get_format_description(),
1034
self.assertEqual('', err)
1036
# Create branch in root of repository
1037
control = repo.bzrdir
1038
branch = control.create_branch()
1039
control.create_workingtree()
1040
out, err = self.runbzr('info repo')
1041
self.assertEqualDiff(
1043
shared repository: %s
1044
repository checkout: .
1047
control: Meta directory format 1
1048
working tree: Working tree format 3
1049
branch: Branch format 5
1052
In the working tree:
1060
0 versioned subdirectories
1068
""" % (repo.bzrdir.root_transport.base,
1069
format.repository_format.get_format_description(),
1071
self.assertEqual('', err)
1073
def assertCheckoutStatusOutput(self,
1074
command_string, lco_tree, shared_repo=None,
1077
branch_locked=False, repo_locked=False,
1079
light_checkout=True):
1080
"""Check the output of info in a light checkout tree.
1082
This is not quite a mirror of the info code: rather than using the
1083
tree being examined to predict output, it uses a bunch of flags which
1084
allow us, the test writers, to document what *should* be present in
1085
the output. Removing this separation would remove the value of the
1088
:param path: the path to the light checkout.
1089
:param lco_tree: the tree object for the light checkout.
1090
:param shared_repo: A shared repository is in use, expect that in
1092
:param repo_branch: A branch in a shared repository for non light
1094
:param tree_locked: If true, expect the tree to be locked.
1095
:param branch_locked: If true, expect the branch to be locked.
1096
:param repo_locked: If true, expect the repository to be locked.
1097
:param verbose: If true, expect verbose output
1099
out, err = self.runbzr('info %s' % command_string)
1100
if repo_locked or branch_locked or tree_locked:
1101
def locked_message(a_bool):
1106
expected_lock_output = (
1109
" working tree: %s\n"
1111
" repository: %s\n" % (
1112
locked_message(tree_locked),
1113
locked_message(branch_locked),
1114
locked_message(repo_locked)))
1116
expected_lock_output = ''
1118
tree_data = (" light checkout root: %s" %
1119
lco_tree.bzrdir.root_transport.base)
1121
tree_data = (" checkout root: %s" %
1122
lco_tree.bzrdir.root_transport.base)
1123
if shared_repo is not None:
1125
" shared repository: %s\n"
1126
" repository branch: branch\n" %
1127
shared_repo.bzrdir.root_transport.base)
1128
elif repo_branch is not None:
1130
" checkout of branch: %s\n" %
1131
repo_branch.bzrdir.root_transport.base)
1133
branch_data = (" checkout of branch: %s\n" %
1134
lco_tree.branch.bzrdir.root_transport.base)
1137
verbose_info = ' 0 committers\n'
1141
self.assertEqualDiff(
1146
control: Meta directory format 1
1148
branch: Branch format 5
1151
In the working tree:
1159
0 versioned subdirectories
1169
lco_tree._format.get_format_description(),
1170
lco_tree.branch.repository._format.get_format_description(),
1171
expected_lock_output,
1174
self.assertEqual('', err)
1176
def test_info_locking(self):
1177
transport = self.get_transport()
1178
# Create shared repository with a branch
1179
repo = self.make_repository('repo', shared=True,
1180
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1181
repo.set_make_working_trees(False)
1182
repo.bzrdir.root_transport.mkdir('branch')
1183
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1184
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1185
# Do a heavy checkout
1186
transport.mkdir('tree')
1187
transport.mkdir('tree/checkout')
1188
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1189
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1190
co_branch.bind(repo_branch)
1191
# Do a light checkout of the heavy one
1192
transport.mkdir('tree/lightcheckout')
1193
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1194
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1195
lco_dir.create_workingtree()
1196
lco_tree = lco_dir.open_workingtree()
1198
# Test all permutations of locking the working tree, branch and repository
1202
self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
1204
lco_tree.branch.repository.lock_write()
1206
self.assertCheckoutStatusOutput('tree/lightcheckout',
1210
lco_tree.branch.repository.unlock()
1212
lco_tree.branch.lock_write()
1214
self.assertCheckoutStatusOutput('tree/lightcheckout',
1219
lco_tree.branch.unlock()
1221
lco_tree.lock_write()
1223
self.assertCheckoutStatusOutput('tree/lightcheckout',
1231
lco_tree.lock_write()
1232
lco_tree.branch.repository.unlock()
1234
self.assertCheckoutStatusOutput('tree/lightcheckout',
1239
lco_tree.branch.repository.lock_write()
1242
lco_tree.lock_write()
1243
lco_tree.branch.unlock()
1245
self.assertCheckoutStatusOutput('tree/lightcheckout',
1249
lco_tree.branch.lock_write()
1252
lco_tree.lock_write()
1253
lco_tree.branch.unlock()
1254
lco_tree.branch.repository.lock_write()
1256
self.assertCheckoutStatusOutput('tree/lightcheckout',
1261
lco_tree.branch.repository.unlock()
1262
lco_tree.branch.lock_write()
1265
lco_tree.branch.lock_write()
1266
lco_tree.branch.repository.unlock()
1268
self.assertCheckoutStatusOutput('tree/lightcheckout',
1272
lco_tree.branch.repository.lock_write()
1273
lco_tree.branch.unlock()
1275
def test_info_locking_oslocks(self):
1276
if sys.platform == "win32":
1277
raise TestSkipped("don't use oslocks on win32 in unix manner")
1279
tree = self.make_branch_and_tree('branch',
1280
format=bzrlib.bzrdir.BzrDirFormat6())
1282
# Test all permutations of locking the working tree, branch and repository
1283
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1284
# implemented by raising NotImplementedError and get_physical_lock_status()
1285
# always returns false. This makes bzr info hide the lock status. (Olaf)
1289
out, err = self.runbzr('info branch')
1290
self.assertEqualDiff(
1295
control: All-in-one format 6
1296
working tree: Working tree format 2
1297
branch: Branch format 4
1300
In the working tree:
1308
0 versioned subdirectories
1316
""" % (tree.bzrdir.root_transport.base,
1317
tree.branch.repository._format.get_format_description(),
1319
self.assertEqual('', err)
1322
out, err = self.runbzr('info branch')
1323
self.assertEqualDiff(
1328
control: All-in-one format 6
1329
working tree: Working tree format 2
1330
branch: Branch format 4
1333
In the working tree:
1341
0 versioned subdirectories
1349
""" % (tree.bzrdir.root_transport.base,
1350
tree.branch.repository._format.get_format_description(),
1352
self.assertEqual('', err)