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."""
31
from bzrlib.osutils import format_date
32
from bzrlib.tests import TestSkipped
33
from bzrlib.tests.blackbox import ExternalBase
36
class TestInfo(ExternalBase):
38
def test_info_non_existing(self):
39
if sys.platform == "win32":
40
location = "C:/i/do/not/exist/"
42
location = "/i/do/not/exist/"
43
out, err = self.run_bzr('info '+location, retcode=3)
44
self.assertEqual(out, '')
45
self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
47
def test_info_standalone(self):
48
transport = self.get_transport()
50
# Create initial standalone branch
51
tree1 = self.make_branch_and_tree('standalone', 'weave')
52
self.build_tree(['standalone/a'])
54
branch1 = tree1.branch
56
out, err = self.run_bzr('info standalone')
58
"""Standalone tree (format: weave)
60
branch root: standalone
62
self.assertEqual('', err)
64
out, err = self.run_bzr('info standalone -v')
66
"""Standalone tree (format: weave)
68
branch root: standalone
71
control: All-in-one format 6
72
working tree: Working tree format 2
73
branch: Branch format 4
74
repository: Weave repository format 6
84
0 versioned subdirectories
93
self.assertEqual('', err)
94
tree1.commit('commit one')
95
rev = branch1.repository.get_revision(branch1.revision_history()[0])
96
datestring_first = format_date(rev.timestamp, rev.timezone)
98
# Branch standalone with push location
99
branch2 = branch1.bzrdir.sprout('branch').open_branch()
100
branch2.set_push_location(branch1.bzrdir.root_transport.base)
102
out, err = self.run_bzr('info branch')
103
self.assertEqualDiff(
104
"""Standalone tree (format: weave)
109
push branch: standalone
110
parent branch: standalone
112
self.assertEqual('', err)
114
out, err = self.run_bzr('info branch --verbose')
115
self.assertEqualDiff(
116
"""Standalone tree (format: weave)
121
push branch: standalone
122
parent branch: standalone
125
control: All-in-one format 6
126
working tree: Working tree format 2
127
branch: Branch format 4
128
repository: Weave repository format 6
138
0 versioned subdirectories
149
""" % (datestring_first, datestring_first,
151
self.assertEqual('', err)
153
# Branch and bind to standalone, needs upgrade to metadir
154
# (creates backup as unknown)
155
branch1.bzrdir.sprout('bound')
156
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
157
upgrade.upgrade('bound', knit1_format)
158
branch3 = bzrdir.BzrDir.open('bound').open_branch()
159
branch3.bind(branch1)
160
bound_tree = branch3.bzrdir.open_workingtree()
161
out, err = self.run_bzr('info -v bound')
162
self.assertEqualDiff(
163
"""Checkout (format: knit)
166
checkout of branch: standalone
169
parent branch: standalone
172
control: Meta directory format 1
185
0 versioned subdirectories
196
""" % (bound_tree._format.get_format_description(),
197
branch3._format.get_format_description(),
198
branch3.repository._format.get_format_description(),
199
datestring_first, datestring_first,
201
self.assertEqual('', err)
203
# Checkout standalone (same as above, but does not have parent set)
204
branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
206
branch4.bind(branch1)
207
branch4.bzrdir.open_workingtree().update()
208
out, err = self.run_bzr('info checkout --verbose')
209
self.assertEqualDiff(
210
"""Checkout (format: knit)
212
checkout root: checkout
213
checkout of branch: standalone
216
control: Meta directory format 1
217
working tree: Working tree format 3
218
branch: Branch format 5
229
0 versioned subdirectories
240
""" % (branch4.repository._format.get_format_description(),
241
datestring_first, datestring_first,
243
self.assertEqual('', err)
245
# Lightweight checkout (same as above, different branch and repository)
246
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
247
branch5 = tree5.branch
248
out, err = self.run_bzr('info -v lightcheckout')
249
self.assertEqualDiff(
250
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root \
251
or dirstate or dirstate-tags or \
252
pack-0.92 or rich-root or rich-root-pack)
254
light checkout root: lightcheckout
255
checkout of branch: standalone
258
control: Meta directory format 1
259
working tree: Working tree format 4
260
branch: Branch format 4
261
repository: Weave repository format 6
271
0 versioned subdirectories
282
""" % (datestring_first, datestring_first,), out)
283
self.assertEqual('', err)
285
# Update initial standalone branch
286
self.build_tree(['standalone/b'])
288
tree1.commit('commit two')
289
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
290
datestring_last = format_date(rev.timestamp, rev.timezone)
292
# Out of date branched standalone branch will not be detected
293
out, err = self.run_bzr('info -v branch')
294
self.assertEqualDiff(
295
"""Standalone tree (format: weave)
300
push branch: standalone
301
parent branch: standalone
304
control: All-in-one format 6
305
working tree: Working tree format 2
306
branch: Branch format 4
307
repository: Weave repository format 6
317
0 versioned subdirectories
328
""" % (datestring_first, datestring_first,
330
self.assertEqual('', err)
332
# Out of date bound branch
333
out, err = self.run_bzr('info -v bound')
334
self.assertEqualDiff(
335
"""Checkout (format: knit)
338
checkout of branch: standalone
341
parent branch: standalone
344
control: Meta directory format 1
345
working tree: Working tree format 3
346
branch: Branch format 5
349
Branch is out of date: missing 1 revision.
359
0 versioned subdirectories
370
""" % (branch3.repository._format.get_format_description(),
371
datestring_first, datestring_first,
373
self.assertEqual('', err)
375
# Out of date checkout
376
out, err = self.run_bzr('info -v checkout')
377
self.assertEqualDiff(
378
"""Checkout (format: knit)
380
checkout root: checkout
381
checkout of branch: standalone
384
control: Meta directory format 1
385
working tree: Working tree format 3
386
branch: Branch format 5
389
Branch is out of date: missing 1 revision.
399
0 versioned subdirectories
410
""" % (branch4.repository._format.get_format_description(),
411
datestring_first, datestring_first,
413
self.assertEqual('', err)
415
# Out of date lightweight checkout
416
out, err = self.run_bzr('info lightcheckout --verbose')
417
self.assertEqualDiff(
418
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
419
dirstate or dirstate-tags or \
420
pack-0.92 or rich-root or rich-root-pack)
422
light checkout root: lightcheckout
423
checkout of branch: standalone
426
control: Meta directory format 1
427
working tree: Working tree format 4
428
branch: Branch format 4
429
repository: Weave repository format 6
431
Working tree is out of date: missing 1 revision.
441
0 versioned subdirectories
452
""" % (datestring_first, datestring_last,), out)
453
self.assertEqual('', err)
455
def test_info_standalone_no_tree(self):
456
# create standalone branch without a working tree
457
format = bzrdir.format_registry.make_bzrdir('default')
458
branch = self.make_branch('branch')
459
repo = branch.repository
460
out, err = self.run_bzr('info branch -v')
461
self.assertEqualDiff(
462
"""Standalone branch (format: %s)
467
control: Meta directory format 1
477
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
478
format.get_branch_format().get_format_description(),
479
format.repository_format.get_format_description(),
481
self.assertEqual('', err)
483
def test_info_shared_repository(self):
484
format = bzrdir.format_registry.make_bzrdir('knit')
485
transport = self.get_transport()
487
# Create shared repository
488
repo = self.make_repository('repo', shared=True, format=format)
489
repo.set_make_working_trees(False)
490
out, err = self.run_bzr('info -v repo')
491
self.assertEqualDiff(
492
"""Shared repository (format: dirstate or dirstate-tags or knit)
494
shared repository: %s
497
control: Meta directory format 1
502
""" % ('repo', format.repository_format.get_format_description(),
504
self.assertEqual('', err)
506
# Create branch inside shared repository
507
repo.bzrdir.root_transport.mkdir('branch')
508
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
510
out, err = self.run_bzr('info -v repo/branch')
511
self.assertEqualDiff(
512
"""Repository branch (format: dirstate or knit)
514
shared repository: repo
515
repository branch: repo/branch
518
control: Meta directory format 1
528
""" % (format.get_branch_format().get_format_description(),
529
format.repository_format.get_format_description(),
531
self.assertEqual('', err)
533
# Create lightweight checkout
534
transport.mkdir('tree')
535
transport.mkdir('tree/lightcheckout')
536
tree2 = branch1.create_checkout('tree/lightcheckout',
538
branch2 = tree2.branch
539
self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
540
shared_repo=repo, repo_branch=branch1, verbose=True)
542
# Create normal checkout
543
tree3 = branch1.create_checkout('tree/checkout')
544
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
546
light_checkout=False, repo_branch=branch1)
547
# Update lightweight checkout
548
self.build_tree(['tree/lightcheckout/a'])
550
tree2.commit('commit one')
551
rev = repo.get_revision(branch2.revision_history()[0])
552
datestring_first = format_date(rev.timestamp, rev.timezone)
553
out, err = self.run_bzr('info tree/lightcheckout --verbose')
554
self.assertEqualDiff(
555
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
556
dirstate or dirstate-tags or \
557
pack-0.92 or rich-root or rich-root-pack)
559
light checkout root: tree/lightcheckout
560
checkout of branch: repo/branch
561
shared repository: repo
564
control: Meta directory format 1
565
working tree: Working tree format 4
577
0 versioned subdirectories
588
""" % (format.get_branch_format().get_format_description(),
589
format.repository_format.get_format_description(),
590
datestring_first, datestring_first,
592
self.assertEqual('', err)
594
# Out of date checkout
595
out, err = self.run_bzr('info -v tree/checkout')
596
self.assertEqualDiff(
597
"""Checkout (format: dirstate)
599
checkout root: tree/checkout
600
checkout of branch: repo/branch
603
control: Meta directory format 1
604
working tree: Working tree format 4
608
Branch is out of date: missing 1 revision.
618
0 versioned subdirectories
626
""" % (format.get_branch_format().get_format_description(),
627
format.repository_format.get_format_description(),
629
self.assertEqual('', err)
633
self.build_tree(['tree/checkout/b'])
635
out, err = self.run_bzr('info tree/checkout --verbose')
636
self.assertEqualDiff(
637
"""Checkout (format: dirstate)
639
checkout root: tree/checkout
640
checkout of branch: repo/branch
643
control: Meta directory format 1
644
working tree: Working tree format 4
656
0 versioned subdirectories
667
""" % (format.get_branch_format().get_format_description(),
668
format.repository_format.get_format_description(),
669
datestring_first, datestring_first,
671
self.assertEqual('', err)
672
tree3.commit('commit two')
674
# Out of date lightweight checkout
675
rev = repo.get_revision(branch1.revision_history()[-1])
676
datestring_last = format_date(rev.timestamp, rev.timezone)
677
out, err = self.run_bzr('info tree/lightcheckout --verbose')
678
self.assertEqualDiff(
679
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
680
dirstate or dirstate-tags or \
681
pack-0.92 or rich-root or rich-root-pack)
683
light checkout root: tree/lightcheckout
684
checkout of branch: repo/branch
685
shared repository: repo
688
control: Meta directory format 1
689
working tree: Working tree format 4
693
Working tree is out of date: missing 1 revision.
703
0 versioned subdirectories
714
""" % (format.get_branch_format().get_format_description(),
715
format.repository_format.get_format_description(),
716
datestring_first, datestring_last,
718
self.assertEqual('', err)
720
# Show info about shared branch
721
out, err = self.run_bzr('info repo/branch --verbose')
722
self.assertEqualDiff(
723
"""Repository branch (format: dirstate or knit)
725
shared repository: repo
726
repository branch: repo/branch
729
control: Meta directory format 1
742
""" % (format.get_branch_format().get_format_description(),
743
format.repository_format.get_format_description(),
744
datestring_first, datestring_last,
746
self.assertEqual('', err)
748
# Show info about repository with revisions
749
out, err = self.run_bzr('info -v repo')
750
self.assertEqualDiff(
751
"""Shared repository (format: dirstate or dirstate-tags or knit)
753
shared repository: repo
756
control: Meta directory format 1
761
""" % (format.repository_format.get_format_description(),
763
self.assertEqual('', err)
765
def test_info_shared_repository_with_trees(self):
766
format = bzrdir.format_registry.make_bzrdir('knit')
767
transport = self.get_transport()
769
# Create shared repository with working trees
770
repo = self.make_repository('repo', shared=True, format=format)
771
repo.set_make_working_trees(True)
772
out, err = self.run_bzr('info -v repo')
773
self.assertEqualDiff(
774
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
776
shared repository: repo
779
control: Meta directory format 1
782
Create working tree for new branches inside the repository.
786
""" % (format.repository_format.get_format_description(),
788
self.assertEqual('', err)
790
# Create two branches
791
repo.bzrdir.root_transport.mkdir('branch1')
792
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
794
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
797
out, err = self.run_bzr('info repo/branch1 --verbose')
798
self.assertEqualDiff(
799
"""Repository tree (format: knit)
801
shared repository: repo
802
repository branch: repo/branch1
805
control: Meta directory format 1
806
working tree: Working tree format 3
818
0 versioned subdirectories
826
""" % (format.get_branch_format().get_format_description(),
827
format.repository_format.get_format_description(),
829
self.assertEqual('', err)
831
# Update first branch
832
self.build_tree(['repo/branch1/a'])
833
tree1 = branch1.bzrdir.open_workingtree()
835
tree1.commit('commit one')
836
rev = repo.get_revision(branch1.revision_history()[0])
837
datestring_first = format_date(rev.timestamp, rev.timezone)
838
out, err = self.run_bzr('info -v repo/branch1')
839
self.assertEqualDiff(
840
"""Repository tree (format: knit)
842
shared repository: repo
843
repository branch: repo/branch1
846
control: Meta directory format 1
847
working tree: Working tree format 3
859
0 versioned subdirectories
870
""" % (format.get_branch_format().get_format_description(),
871
format.repository_format.get_format_description(),
872
datestring_first, datestring_first,
874
self.assertEqual('', err)
876
# Out of date second branch
877
out, err = self.run_bzr('info repo/branch2 --verbose')
878
self.assertEqualDiff(
879
"""Repository tree (format: knit)
881
shared repository: repo
882
repository branch: repo/branch2
885
parent branch: repo/branch1
888
control: Meta directory format 1
889
working tree: Working tree format 3
901
0 versioned subdirectories
909
""" % (format.get_branch_format().get_format_description(),
910
format.repository_format.get_format_description(),
912
self.assertEqual('', err)
914
# Update second branch
915
tree2 = branch2.bzrdir.open_workingtree()
917
out, err = self.run_bzr('info -v repo/branch2')
918
self.assertEqualDiff(
919
"""Repository tree (format: knit)
921
shared repository: repo
922
repository branch: repo/branch2
925
parent branch: repo/branch1
928
control: Meta directory format 1
929
working tree: Working tree format 3
941
0 versioned subdirectories
952
""" % (format.get_branch_format().get_format_description(),
953
format.repository_format.get_format_description(),
954
datestring_first, datestring_first,
956
self.assertEqual('', err)
958
# Show info about repository with revisions
959
out, err = self.run_bzr('info -v repo')
960
self.assertEqualDiff(
961
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
963
shared repository: repo
966
control: Meta directory format 1
969
Create working tree for new branches inside the repository.
973
""" % (format.repository_format.get_format_description(),
976
self.assertEqual('', err)
978
def test_info_shared_repository_with_tree_in_root(self):
979
format = bzrdir.format_registry.make_bzrdir('knit')
980
transport = self.get_transport()
982
# Create shared repository with working trees
983
repo = self.make_repository('repo', shared=True, format=format)
984
repo.set_make_working_trees(True)
985
out, err = self.run_bzr('info -v repo')
986
self.assertEqualDiff(
987
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
989
shared repository: repo
992
control: Meta directory format 1
995
Create working tree for new branches inside the repository.
999
""" % (format.repository_format.get_format_description(),
1001
self.assertEqual('', err)
1003
# Create branch in root of repository
1004
control = repo.bzrdir
1005
branch = control.create_branch()
1006
control.create_workingtree()
1007
out, err = self.run_bzr('info -v repo')
1008
self.assertEqualDiff(
1009
"""Repository tree (format: knit)
1011
shared repository: repo
1012
repository branch: repo
1015
control: Meta directory format 1
1016
working tree: Working tree format 3
1020
In the working tree:
1028
0 versioned subdirectories
1036
""" % (format.get_branch_format().get_format_description(),
1037
format.repository_format.get_format_description(),
1039
self.assertEqual('', err)
1041
def assertCheckoutStatusOutput(self,
1042
command_string, lco_tree, shared_repo=None,
1045
branch_locked=False, repo_locked=False,
1047
light_checkout=True,
1048
checkout_root=None):
1049
"""Check the output of info in a checkout.
1051
This is not quite a mirror of the info code: rather than using the
1052
tree being examined to predict output, it uses a bunch of flags which
1053
allow us, the test writers, to document what *should* be present in
1054
the output. Removing this separation would remove the value of the
1057
:param path: the path to the light checkout.
1058
:param lco_tree: the tree object for the light checkout.
1059
:param shared_repo: A shared repository is in use, expect that in
1061
:param repo_branch: A branch in a shared repository for non light
1063
:param tree_locked: If true, expect the tree to be locked.
1064
:param branch_locked: If true, expect the branch to be locked.
1065
:param repo_locked: If true, expect the repository to be locked.
1066
Note that the lco_tree.branch.repository is inspected, and if is not
1067
actually locked then this parameter is overridden. This is because
1068
pack repositories do not have any public API for obtaining an
1069
exclusive repository wide lock.
1070
:param verbose: If true, expect verbose output
1072
def friendly_location(url):
1073
path = urlutils.unescape_for_display(url, 'ascii')
1075
return osutils.relpath(osutils.getcwd(), path)
1076
except errors.PathNotChild:
1080
# We expect this to fail because of locking errors.
1081
# (A write-locked file cannot be read-locked
1082
# in the different process -- either on win32 or on linux).
1083
# This should be removed when the locking errors are fixed.
1084
self.expectFailure('OS locks are exclusive '
1085
'for different processes (Bug #174055)',
1086
self.run_bzr_subprocess,
1087
'info ' + command_string)
1088
out, err = self.run_bzr('info %s' % command_string)
1090
(True, True): 'Lightweight checkout',
1091
(True, False): 'Repository checkout',
1092
(False, True): 'Lightweight checkout',
1093
(False, False): 'Checkout',
1094
}[(shared_repo is not None, light_checkout)]
1095
format = {True: '1.6 or 1.6.1-rich-root'
1096
' or dirstate or dirstate-tags or pack-0.92'
1097
' or rich-root or rich-root-pack',
1098
False: 'dirstate'}[light_checkout]
1100
repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1101
if repo_locked or branch_locked or tree_locked:
1102
def locked_message(a_bool):
1107
expected_lock_output = (
1110
" working tree: %s\n"
1112
" repository: %s\n" % (
1113
locked_message(tree_locked),
1114
locked_message(branch_locked),
1115
locked_message(repo_locked)))
1117
expected_lock_output = ''
1121
tree_data = (" light checkout root: %s\n" %
1122
friendly_location(lco_tree.bzrdir.root_transport.base))
1124
if lco_tree.branch.get_bound_location() is not None:
1125
tree_data += ("%s checkout root: %s\n" % (extra_space,
1126
friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1127
if shared_repo is not None:
1129
" checkout of branch: %s\n"
1130
" shared repository: %s\n" %
1131
(friendly_location(repo_branch.bzrdir.root_transport.base),
1132
friendly_location(shared_repo.bzrdir.root_transport.base)))
1133
elif repo_branch is not None:
1135
"%s checkout of branch: %s\n" %
1137
friendly_location(repo_branch.bzrdir.root_transport.base)))
1139
branch_data = (" checkout of branch: %s\n" %
1140
lco_tree.branch.bzrdir.root_transport.base)
1143
verbose_info = ' 0 committers\n'
1147
self.assertEqualDiff(
1152
control: Meta directory format 1
1157
In the working tree:
1165
0 versioned subdirectories
1176
lco_tree._format.get_format_description(),
1177
lco_tree.branch._format.get_format_description(),
1178
lco_tree.branch.repository._format.get_format_description(),
1179
expected_lock_output,
1182
self.assertEqual('', err)
1184
def test_info_locking(self):
1185
transport = self.get_transport()
1186
# Create shared repository with a branch
1187
repo = self.make_repository('repo', shared=True,
1188
format=bzrdir.BzrDirMetaFormat1())
1189
repo.set_make_working_trees(False)
1190
repo.bzrdir.root_transport.mkdir('branch')
1191
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1192
format=bzrdir.BzrDirMetaFormat1())
1193
# Do a heavy checkout
1194
transport.mkdir('tree')
1195
transport.mkdir('tree/checkout')
1196
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1197
format=bzrdir.BzrDirMetaFormat1())
1198
co_branch.bind(repo_branch)
1199
# Do a light checkout of the heavy one
1200
transport.mkdir('tree/lightcheckout')
1201
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1202
branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1203
lco_dir.create_workingtree()
1204
lco_tree = lco_dir.open_workingtree()
1206
# Test all permutations of locking the working tree, branch and repository
1210
self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1211
repo_branch=repo_branch,
1212
verbose=True, light_checkout=True)
1214
lco_tree.branch.repository.lock_write()
1216
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1217
lco_tree, repo_branch=repo_branch,
1218
repo_locked=True, verbose=True, light_checkout=True)
1220
lco_tree.branch.repository.unlock()
1222
lco_tree.branch.lock_write()
1224
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1228
repo_branch=repo_branch,
1231
lco_tree.branch.unlock()
1233
lco_tree.lock_write()
1235
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1236
lco_tree, repo_branch=repo_branch,
1244
lco_tree.lock_write()
1245
lco_tree.branch.repository.unlock()
1247
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1248
lco_tree, repo_branch=repo_branch,
1253
lco_tree.branch.repository.lock_write()
1256
lco_tree.lock_write()
1257
lco_tree.branch.unlock()
1259
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1260
lco_tree, repo_branch=repo_branch,
1264
lco_tree.branch.lock_write()
1267
lco_tree.lock_write()
1268
lco_tree.branch.unlock()
1269
lco_tree.branch.repository.lock_write()
1271
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1272
lco_tree, repo_branch=repo_branch,
1277
lco_tree.branch.repository.unlock()
1278
lco_tree.branch.lock_write()
1281
lco_tree.branch.lock_write()
1282
lco_tree.branch.repository.unlock()
1284
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1285
lco_tree, repo_branch=repo_branch,
1289
lco_tree.branch.repository.lock_write()
1290
lco_tree.branch.unlock()
1292
if sys.platform == 'win32':
1293
self.knownFailure('Win32 cannot run "bzr info"'
1294
' when the tree is locked.')
1296
def test_info_locking_oslocks(self):
1297
if sys.platform == "win32":
1298
raise TestSkipped("don't use oslocks on win32 in unix manner")
1300
tree = self.make_branch_and_tree('branch',
1301
format=bzrdir.BzrDirFormat6())
1303
# Test all permutations of locking the working tree, branch and repository
1304
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1305
# implemented by raising NotImplementedError and get_physical_lock_status()
1306
# always returns false. This makes bzr info hide the lock status. (Olaf)
1310
out, err = self.run_bzr('info -v branch')
1311
self.assertEqualDiff(
1312
"""Standalone tree (format: weave)
1317
control: All-in-one format 6
1318
working tree: Working tree format 2
1319
branch: Branch format 4
1322
In the working tree:
1330
0 versioned subdirectories
1338
""" % ('branch', tree.branch.repository._format.get_format_description(),
1340
self.assertEqual('', err)
1343
out, err = self.run_bzr('info -v branch')
1344
self.assertEqualDiff(
1345
"""Standalone tree (format: weave)
1350
control: All-in-one format 6
1351
working tree: Working tree format 2
1352
branch: Branch format 4
1355
In the working tree:
1363
0 versioned subdirectories
1371
""" % ('branch', tree.branch.repository._format.get_format_description(),
1373
self.assertEqual('', err)
1376
def test_info_stacked(self):
1377
# We have a mainline
1378
trunk_tree = self.make_branch_and_tree('mainline',
1380
trunk_tree.commit('mainline')
1381
# and a branch from it which is stacked
1382
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1383
out, err = self.run_bzr('info newbranch')
1385
"""Standalone tree (format: 1.6)
1387
branch root: newbranch
1390
parent branch: mainline
1391
stacked on: mainline
1393
self.assertEqual("", err)