1
# Copyright (C) 2006, 2007, 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 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):
39
ExternalBase.setUp(self)
40
self._repo_strings = "2a or development-subtree"
42
def test_info_non_existing(self):
43
if sys.platform == "win32":
44
location = "C:/i/do/not/exist/"
46
location = "/i/do/not/exist/"
47
out, err = self.run_bzr('info '+location, retcode=3)
48
self.assertEqual(out, '')
49
self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
51
def test_info_standalone(self):
52
transport = self.get_transport()
54
# Create initial standalone branch
55
tree1 = self.make_branch_and_tree('standalone', 'weave')
56
self.build_tree(['standalone/a'])
58
branch1 = tree1.branch
60
out, err = self.run_bzr('info standalone')
62
"""Standalone tree (format: weave)
64
branch root: standalone
66
self.assertEqual('', err)
68
# Standalone branch - verbose mode
69
out, err = self.run_bzr('info standalone -v')
71
"""Standalone tree (format: weave)
73
branch root: standalone
76
control: All-in-one format 6
77
working tree: Working tree format 2
78
branch: Branch format 4
79
repository: Weave repository format 6
89
0 versioned subdirectories
97
self.assertEqual('', err)
99
# Standalone branch - really verbose mode
100
out, err = self.run_bzr('info standalone -vv')
101
self.assertEqualDiff(
102
"""Standalone tree (format: weave)
104
branch root: standalone
107
control: All-in-one format 6
108
working tree: Working tree format 2
109
branch: Branch format 4
110
repository: Weave repository format 6
120
0 versioned subdirectories
129
self.assertEqual('', err)
130
tree1.commit('commit one')
131
rev = branch1.repository.get_revision(branch1.revision_history()[0])
132
datestring_first = format_date(rev.timestamp, rev.timezone)
134
# Branch standalone with push location
135
branch2 = branch1.bzrdir.sprout('branch').open_branch()
136
branch2.set_push_location(branch1.bzrdir.root_transport.base)
138
out, err = self.run_bzr('info branch')
139
self.assertEqualDiff(
140
"""Standalone tree (format: weave)
145
push branch: standalone
146
parent branch: standalone
148
self.assertEqual('', err)
150
out, err = self.run_bzr('info branch --verbose')
151
self.assertEqualDiff(
152
"""Standalone tree (format: weave)
157
push branch: standalone
158
parent branch: standalone
161
control: All-in-one format 6
162
working tree: Working tree format 2
163
branch: Branch format 4
164
repository: Weave repository format 6
174
0 versioned subdirectories
184
""" % (datestring_first, datestring_first,
186
self.assertEqual('', err)
188
# Branch and bind to standalone, needs upgrade to metadir
189
# (creates backup as unknown)
190
branch1.bzrdir.sprout('bound')
191
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
192
upgrade.upgrade('bound', knit1_format)
193
branch3 = bzrdir.BzrDir.open('bound').open_branch()
194
branch3.bind(branch1)
195
bound_tree = branch3.bzrdir.open_workingtree()
196
out, err = self.run_bzr('info -v bound')
197
self.assertEqualDiff(
198
"""Checkout (format: knit)
201
checkout of branch: standalone
204
parent branch: standalone
207
control: Meta directory format 1
220
0 versioned subdirectories
230
""" % (bound_tree._format.get_format_description(),
231
branch3._format.get_format_description(),
232
branch3.repository._format.get_format_description(),
233
datestring_first, datestring_first,
235
self.assertEqual('', err)
237
# Checkout standalone (same as above, but does not have parent set)
238
branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
240
branch4.bind(branch1)
241
branch4.bzrdir.open_workingtree().update()
242
out, err = self.run_bzr('info checkout --verbose')
243
self.assertEqualDiff(
244
"""Checkout (format: knit)
246
checkout root: checkout
247
checkout of branch: standalone
250
control: Meta directory format 1
251
working tree: Working tree format 3
252
branch: Branch format 5
263
0 versioned subdirectories
273
""" % (branch4.repository._format.get_format_description(),
274
datestring_first, datestring_first,
276
self.assertEqual('', err)
278
# Lightweight checkout (same as above, different branch and repository)
279
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
280
branch5 = tree5.branch
281
out, err = self.run_bzr('info -v lightcheckout')
282
self.assertEqualDiff(
283
"""Lightweight checkout (format: %s)
285
light checkout root: lightcheckout
286
checkout of branch: standalone
289
control: Meta directory format 1
290
working tree: Working tree format 6
291
branch: Branch format 4
292
repository: Weave repository format 6
302
0 versioned subdirectories
312
""" % (self._repo_strings, datestring_first, datestring_first,), out)
313
self.assertEqual('', err)
315
# Update initial standalone branch
316
self.build_tree(['standalone/b'])
318
tree1.commit('commit two')
319
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
320
datestring_last = format_date(rev.timestamp, rev.timezone)
322
# Out of date branched standalone branch will not be detected
323
out, err = self.run_bzr('info -v branch')
324
self.assertEqualDiff(
325
"""Standalone tree (format: weave)
330
push branch: standalone
331
parent branch: standalone
334
control: All-in-one format 6
335
working tree: Working tree format 2
336
branch: Branch format 4
337
repository: Weave repository format 6
347
0 versioned subdirectories
357
""" % (datestring_first, datestring_first,
359
self.assertEqual('', err)
361
# Out of date bound branch
362
out, err = self.run_bzr('info -v bound')
363
self.assertEqualDiff(
364
"""Checkout (format: knit)
367
checkout of branch: standalone
370
parent branch: standalone
373
control: Meta directory format 1
374
working tree: Working tree format 3
375
branch: Branch format 5
378
Branch is out of date: missing 1 revision.
388
0 versioned subdirectories
398
""" % (branch3.repository._format.get_format_description(),
399
datestring_first, datestring_first,
401
self.assertEqual('', err)
403
# Out of date checkout
404
out, err = self.run_bzr('info -v checkout')
405
self.assertEqualDiff(
406
"""Checkout (format: knit)
408
checkout root: checkout
409
checkout of branch: standalone
412
control: Meta directory format 1
413
working tree: Working tree format 3
414
branch: Branch format 5
417
Branch is out of date: missing 1 revision.
427
0 versioned subdirectories
437
""" % (branch4.repository._format.get_format_description(),
438
datestring_first, datestring_first,
440
self.assertEqual('', err)
442
# Out of date lightweight checkout
443
out, err = self.run_bzr('info lightcheckout --verbose')
444
self.assertEqualDiff(
445
"""Lightweight checkout (format: %s)
447
light checkout root: lightcheckout
448
checkout of branch: standalone
451
control: Meta directory format 1
452
working tree: Working tree format 6
453
branch: Branch format 4
454
repository: Weave repository format 6
456
Working tree is out of date: missing 1 revision.
466
0 versioned subdirectories
476
""" % (self._repo_strings, datestring_first, datestring_last,), out)
477
self.assertEqual('', err)
479
def test_info_standalone_no_tree(self):
480
# create standalone branch without a working tree
481
format = bzrdir.format_registry.make_bzrdir('default')
482
branch = self.make_branch('branch')
483
repo = branch.repository
484
out, err = self.run_bzr('info branch -v')
485
self.assertEqualDiff(
486
"""Standalone branch (format: %s)
491
control: Meta directory format 1
500
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
501
format.get_branch_format().get_format_description(),
502
format.repository_format.get_format_description(),
504
self.assertEqual('', err)
506
def test_info_shared_repository(self):
507
format = bzrdir.format_registry.make_bzrdir('knit')
508
transport = self.get_transport()
510
# Create shared repository
511
repo = self.make_repository('repo', shared=True, format=format)
512
repo.set_make_working_trees(False)
513
out, err = self.run_bzr('info -v repo')
514
self.assertEqualDiff(
515
"""Shared repository (format: dirstate or dirstate-tags or knit)
517
shared repository: %s
520
control: Meta directory format 1
525
""" % ('repo', format.repository_format.get_format_description(),
527
self.assertEqual('', err)
529
# Create branch inside shared repository
530
repo.bzrdir.root_transport.mkdir('branch')
531
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
533
out, err = self.run_bzr('info -v repo/branch')
534
self.assertEqualDiff(
535
"""Repository branch (format: dirstate or knit)
537
shared repository: repo
538
repository branch: repo/branch
541
control: Meta directory format 1
550
""" % (format.get_branch_format().get_format_description(),
551
format.repository_format.get_format_description(),
553
self.assertEqual('', err)
555
# Create lightweight checkout
556
transport.mkdir('tree')
557
transport.mkdir('tree/lightcheckout')
558
tree2 = branch1.create_checkout('tree/lightcheckout',
560
branch2 = tree2.branch
561
self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
562
shared_repo=repo, repo_branch=branch1, verbose=True)
564
# Create normal checkout
565
tree3 = branch1.create_checkout('tree/checkout')
566
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
568
light_checkout=False, repo_branch=branch1)
569
# Update lightweight checkout
570
self.build_tree(['tree/lightcheckout/a'])
572
tree2.commit('commit one')
573
rev = repo.get_revision(branch2.revision_history()[0])
574
datestring_first = format_date(rev.timestamp, rev.timezone)
575
out, err = self.run_bzr('info tree/lightcheckout --verbose')
576
self.assertEqualDiff(
577
"""Lightweight checkout (format: %s)
579
light checkout root: tree/lightcheckout
580
checkout of branch: repo/branch
581
shared repository: repo
584
control: Meta directory format 1
585
working tree: Working tree format 6
597
0 versioned subdirectories
607
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
608
format.repository_format.get_format_description(),
609
datestring_first, datestring_first,
611
self.assertEqual('', err)
613
# Out of date checkout
614
out, err = self.run_bzr('info -v tree/checkout')
615
self.assertEqualDiff(
616
"""Checkout (format: unnamed)
618
checkout root: tree/checkout
619
checkout of branch: repo/branch
622
control: Meta directory format 1
623
working tree: Working tree format 6
627
Branch is out of date: missing 1 revision.
637
0 versioned subdirectories
644
""" % (format.get_branch_format().get_format_description(),
645
format.repository_format.get_format_description(),
647
self.assertEqual('', err)
651
self.build_tree(['tree/checkout/b'])
653
out, err = self.run_bzr('info tree/checkout --verbose')
654
self.assertEqualDiff(
655
"""Checkout (format: unnamed)
657
checkout root: tree/checkout
658
checkout of branch: repo/branch
661
control: Meta directory format 1
662
working tree: Working tree format 6
674
0 versioned subdirectories
684
""" % (format.get_branch_format().get_format_description(),
685
format.repository_format.get_format_description(),
686
datestring_first, datestring_first,
688
self.assertEqual('', err)
689
tree3.commit('commit two')
691
# Out of date lightweight checkout
692
rev = repo.get_revision(branch1.revision_history()[-1])
693
datestring_last = format_date(rev.timestamp, rev.timezone)
694
out, err = self.run_bzr('info tree/lightcheckout --verbose')
695
self.assertEqualDiff(
696
"""Lightweight checkout (format: %s)
698
light checkout root: tree/lightcheckout
699
checkout of branch: repo/branch
700
shared repository: repo
703
control: Meta directory format 1
704
working tree: Working tree format 6
708
Working tree is out of date: missing 1 revision.
718
0 versioned subdirectories
728
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
729
format.repository_format.get_format_description(),
730
datestring_first, datestring_last,
732
self.assertEqual('', err)
734
# Show info about shared branch
735
out, err = self.run_bzr('info repo/branch --verbose')
736
self.assertEqualDiff(
737
"""Repository branch (format: dirstate or knit)
739
shared repository: repo
740
repository branch: repo/branch
743
control: Meta directory format 1
755
""" % (format.get_branch_format().get_format_description(),
756
format.repository_format.get_format_description(),
757
datestring_first, datestring_last,
759
self.assertEqual('', err)
761
# Show info about repository with revisions
762
out, err = self.run_bzr('info -v repo')
763
self.assertEqualDiff(
764
"""Shared repository (format: dirstate or dirstate-tags or knit)
766
shared repository: repo
769
control: Meta directory format 1
774
""" % (format.repository_format.get_format_description(),
776
self.assertEqual('', err)
778
def test_info_shared_repository_with_trees(self):
779
format = bzrdir.format_registry.make_bzrdir('knit')
780
transport = self.get_transport()
782
# Create shared repository with working trees
783
repo = self.make_repository('repo', shared=True, format=format)
784
repo.set_make_working_trees(True)
785
out, err = self.run_bzr('info -v repo')
786
self.assertEqualDiff(
787
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
789
shared repository: repo
792
control: Meta directory format 1
795
Create working tree for new branches inside the repository.
799
""" % (format.repository_format.get_format_description(),
801
self.assertEqual('', err)
803
# Create two branches
804
repo.bzrdir.root_transport.mkdir('branch1')
805
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
807
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
810
out, err = self.run_bzr('info repo/branch1 --verbose')
811
self.assertEqualDiff(
812
"""Repository tree (format: knit)
814
shared repository: repo
815
repository branch: repo/branch1
818
control: Meta directory format 1
819
working tree: Working tree format 3
831
0 versioned subdirectories
838
""" % (format.get_branch_format().get_format_description(),
839
format.repository_format.get_format_description(),
841
self.assertEqual('', err)
843
# Update first branch
844
self.build_tree(['repo/branch1/a'])
845
tree1 = branch1.bzrdir.open_workingtree()
847
tree1.commit('commit one')
848
rev = repo.get_revision(branch1.revision_history()[0])
849
datestring_first = format_date(rev.timestamp, rev.timezone)
850
out, err = self.run_bzr('info -v repo/branch1')
851
self.assertEqualDiff(
852
"""Repository tree (format: knit)
854
shared repository: repo
855
repository branch: repo/branch1
858
control: Meta directory format 1
859
working tree: Working tree format 3
871
0 versioned subdirectories
881
""" % (format.get_branch_format().get_format_description(),
882
format.repository_format.get_format_description(),
883
datestring_first, datestring_first,
885
self.assertEqual('', err)
887
# Out of date second branch
888
out, err = self.run_bzr('info repo/branch2 --verbose')
889
self.assertEqualDiff(
890
"""Repository tree (format: knit)
892
shared repository: repo
893
repository branch: repo/branch2
896
parent branch: repo/branch1
899
control: Meta directory format 1
900
working tree: Working tree format 3
912
0 versioned subdirectories
919
""" % (format.get_branch_format().get_format_description(),
920
format.repository_format.get_format_description(),
922
self.assertEqual('', err)
924
# Update second branch
925
tree2 = branch2.bzrdir.open_workingtree()
927
out, err = self.run_bzr('info -v repo/branch2')
928
self.assertEqualDiff(
929
"""Repository tree (format: knit)
931
shared repository: repo
932
repository branch: repo/branch2
935
parent branch: repo/branch1
938
control: Meta directory format 1
939
working tree: Working tree format 3
951
0 versioned subdirectories
961
""" % (format.get_branch_format().get_format_description(),
962
format.repository_format.get_format_description(),
963
datestring_first, datestring_first,
965
self.assertEqual('', err)
967
# Show info about repository with revisions
968
out, err = self.run_bzr('info -v repo')
969
self.assertEqualDiff(
970
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
972
shared repository: repo
975
control: Meta directory format 1
978
Create working tree for new branches inside the repository.
982
""" % (format.repository_format.get_format_description(),
985
self.assertEqual('', err)
987
def test_info_shared_repository_with_tree_in_root(self):
988
format = bzrdir.format_registry.make_bzrdir('knit')
989
transport = self.get_transport()
991
# Create shared repository with working trees
992
repo = self.make_repository('repo', shared=True, format=format)
993
repo.set_make_working_trees(True)
994
out, err = self.run_bzr('info -v repo')
995
self.assertEqualDiff(
996
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
998
shared repository: repo
1001
control: Meta directory format 1
1004
Create working tree for new branches inside the repository.
1008
""" % (format.repository_format.get_format_description(),
1010
self.assertEqual('', err)
1012
# Create branch in root of repository
1013
control = repo.bzrdir
1014
branch = control.create_branch()
1015
control.create_workingtree()
1016
out, err = self.run_bzr('info -v repo')
1017
self.assertEqualDiff(
1018
"""Repository tree (format: knit)
1020
shared repository: repo
1021
repository branch: repo
1024
control: Meta directory format 1
1025
working tree: Working tree format 3
1029
In the working tree:
1037
0 versioned subdirectories
1044
""" % (format.get_branch_format().get_format_description(),
1045
format.repository_format.get_format_description(),
1047
self.assertEqual('', err)
1049
def test_info_repository_hook(self):
1050
format = bzrdir.format_registry.make_bzrdir('knit')
1051
def repo_info(repo, stats, outf):
1052
outf.write("more info\n")
1053
info.hooks.install_named_hook('repository', repo_info, None)
1054
# Create shared repository with working trees
1055
repo = self.make_repository('repo', shared=True, format=format)
1056
out, err = self.run_bzr('info -v repo')
1057
self.assertEqualDiff(
1058
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1060
shared repository: repo
1063
control: Meta directory format 1
1066
Create working tree for new branches inside the repository.
1071
""" % (format.repository_format.get_format_description(),
1073
self.assertEqual('', err)
1075
def assertCheckoutStatusOutput(self,
1076
command_string, lco_tree, shared_repo=None,
1079
branch_locked=False, repo_locked=False,
1081
light_checkout=True,
1082
checkout_root=None):
1083
"""Check the output of info in a checkout.
1085
This is not quite a mirror of the info code: rather than using the
1086
tree being examined to predict output, it uses a bunch of flags which
1087
allow us, the test writers, to document what *should* be present in
1088
the output. Removing this separation would remove the value of the
1091
:param path: the path to the light checkout.
1092
:param lco_tree: the tree object for the light checkout.
1093
:param shared_repo: A shared repository is in use, expect that in
1095
:param repo_branch: A branch in a shared repository for non light
1097
:param tree_locked: If true, expect the tree to be locked.
1098
:param branch_locked: If true, expect the branch to be locked.
1099
:param repo_locked: If true, expect the repository to be locked.
1100
Note that the lco_tree.branch.repository is inspected, and if is not
1101
actually locked then this parameter is overridden. This is because
1102
pack repositories do not have any public API for obtaining an
1103
exclusive repository wide lock.
1104
:param verbose: verbosity level: 2 or higher to show committers
1106
def friendly_location(url):
1107
path = urlutils.unescape_for_display(url, 'ascii')
1109
return osutils.relpath(osutils.getcwd(), path)
1110
except errors.PathNotChild:
1114
# We expect this to fail because of locking errors.
1115
# (A write-locked file cannot be read-locked
1116
# in the different process -- either on win32 or on linux).
1117
# This should be removed when the locking errors are fixed.
1118
self.expectFailure('OS locks are exclusive '
1119
'for different processes (Bug #174055)',
1120
self.run_bzr_subprocess,
1121
'info ' + command_string)
1122
out, err = self.run_bzr('info %s' % command_string)
1124
(True, True): 'Lightweight checkout',
1125
(True, False): 'Repository checkout',
1126
(False, True): 'Lightweight checkout',
1127
(False, False): 'Checkout',
1128
}[(shared_repo is not None, light_checkout)]
1129
format = {True: self._repo_strings,
1130
False: 'unnamed'}[light_checkout]
1132
repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1133
if repo_locked or branch_locked or tree_locked:
1134
def locked_message(a_bool):
1139
expected_lock_output = (
1142
" working tree: %s\n"
1144
" repository: %s\n" % (
1145
locked_message(tree_locked),
1146
locked_message(branch_locked),
1147
locked_message(repo_locked)))
1149
expected_lock_output = ''
1153
tree_data = (" light checkout root: %s\n" %
1154
friendly_location(lco_tree.bzrdir.root_transport.base))
1156
if lco_tree.branch.get_bound_location() is not None:
1157
tree_data += ("%s checkout root: %s\n" % (extra_space,
1158
friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1159
if shared_repo is not None:
1161
" checkout of branch: %s\n"
1162
" shared repository: %s\n" %
1163
(friendly_location(repo_branch.bzrdir.root_transport.base),
1164
friendly_location(shared_repo.bzrdir.root_transport.base)))
1165
elif repo_branch is not None:
1167
"%s checkout of branch: %s\n" %
1169
friendly_location(repo_branch.bzrdir.root_transport.base)))
1171
branch_data = (" checkout of branch: %s\n" %
1172
lco_tree.branch.bzrdir.root_transport.base)
1175
verbose_info = ' 0 committers\n'
1179
self.assertEqualDiff(
1184
control: Meta directory format 1
1189
In the working tree:
1197
0 versioned subdirectories
1208
lco_tree._format.get_format_description(),
1209
lco_tree.branch._format.get_format_description(),
1210
lco_tree.branch.repository._format.get_format_description(),
1211
expected_lock_output,
1214
self.assertEqual('', err)
1216
def test_info_locking(self):
1217
transport = self.get_transport()
1218
# Create shared repository with a branch
1219
repo = self.make_repository('repo', shared=True,
1220
format=bzrdir.BzrDirMetaFormat1())
1221
repo.set_make_working_trees(False)
1222
repo.bzrdir.root_transport.mkdir('branch')
1223
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1224
format=bzrdir.BzrDirMetaFormat1())
1225
# Do a heavy checkout
1226
transport.mkdir('tree')
1227
transport.mkdir('tree/checkout')
1228
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1229
format=bzrdir.BzrDirMetaFormat1())
1230
co_branch.bind(repo_branch)
1231
# Do a light checkout of the heavy one
1232
transport.mkdir('tree/lightcheckout')
1233
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1234
branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1235
lco_dir.create_workingtree()
1236
lco_tree = lco_dir.open_workingtree()
1238
# Test all permutations of locking the working tree, branch and repository
1242
self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1243
repo_branch=repo_branch,
1244
verbose=True, light_checkout=True)
1246
lco_tree.branch.repository.lock_write()
1248
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1249
lco_tree, repo_branch=repo_branch,
1250
repo_locked=True, verbose=True, light_checkout=True)
1252
lco_tree.branch.repository.unlock()
1254
lco_tree.branch.lock_write()
1256
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1260
repo_branch=repo_branch,
1263
lco_tree.branch.unlock()
1265
lco_tree.lock_write()
1267
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1268
lco_tree, repo_branch=repo_branch,
1276
lco_tree.lock_write()
1277
lco_tree.branch.repository.unlock()
1279
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1280
lco_tree, repo_branch=repo_branch,
1285
lco_tree.branch.repository.lock_write()
1288
lco_tree.lock_write()
1289
lco_tree.branch.unlock()
1291
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1292
lco_tree, repo_branch=repo_branch,
1296
lco_tree.branch.lock_write()
1299
lco_tree.lock_write()
1300
lco_tree.branch.unlock()
1301
lco_tree.branch.repository.lock_write()
1303
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1304
lco_tree, repo_branch=repo_branch,
1309
lco_tree.branch.repository.unlock()
1310
lco_tree.branch.lock_write()
1313
lco_tree.branch.lock_write()
1314
lco_tree.branch.repository.unlock()
1316
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1317
lco_tree, repo_branch=repo_branch,
1321
lco_tree.branch.repository.lock_write()
1322
lco_tree.branch.unlock()
1324
if sys.platform == 'win32':
1325
self.knownFailure('Win32 cannot run "bzr info"'
1326
' when the tree is locked.')
1328
def test_info_locking_oslocks(self):
1329
if sys.platform == "win32":
1330
raise TestSkipped("don't use oslocks on win32 in unix manner")
1331
self.thisFailsStrictLockCheck()
1333
tree = self.make_branch_and_tree('branch',
1334
format=bzrdir.BzrDirFormat6())
1336
# Test all permutations of locking the working tree, branch and repository
1337
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1338
# implemented by raising NotImplementedError and get_physical_lock_status()
1339
# always returns false. This makes bzr info hide the lock status. (Olaf)
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
1370
""" % ('branch', tree.branch.repository._format.get_format_description(),
1372
self.assertEqual('', err)
1375
out, err = self.run_bzr('info -v branch')
1376
self.assertEqualDiff(
1377
"""Standalone tree (format: weave)
1382
control: All-in-one format 6
1383
working tree: Working tree format 2
1384
branch: Branch format 4
1387
In the working tree:
1395
0 versioned subdirectories
1402
""" % ('branch', tree.branch.repository._format.get_format_description(),
1404
self.assertEqual('', err)
1407
def test_info_stacked(self):
1408
# We have a mainline
1409
trunk_tree = self.make_branch_and_tree('mainline',
1411
trunk_tree.commit('mainline')
1412
# and a branch from it which is stacked
1413
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1414
out, err = self.run_bzr('info newbranch')
1416
"""Standalone tree (format: 1.6)
1418
branch root: newbranch
1421
parent branch: mainline
1422
stacked on: mainline
1424
self.assertEqual("", err)