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."""
32
from bzrlib.osutils import format_date
33
from bzrlib.tests import TestSkipped
34
from bzrlib.tests.blackbox import ExternalBase
37
class TestInfo(ExternalBase):
39
def test_info_non_existing(self):
40
if sys.platform == "win32":
41
location = "C:/i/do/not/exist/"
43
location = "/i/do/not/exist/"
44
out, err = self.run_bzr('info '+location, retcode=3)
45
self.assertEqual(out, '')
46
self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
48
def test_info_standalone(self):
49
transport = self.get_transport()
51
# Create initial standalone branch
52
tree1 = self.make_branch_and_tree('standalone', 'weave')
53
self.build_tree(['standalone/a'])
55
branch1 = tree1.branch
57
out, err = self.run_bzr('info standalone')
59
"""Standalone tree (format: weave)
61
branch root: standalone
63
self.assertEqual('', err)
65
out, err = self.run_bzr('info standalone -v')
67
"""Standalone tree (format: weave)
69
branch root: standalone
72
control: All-in-one format 6
73
working tree: Working tree format 2
74
branch: Branch format 4
75
repository: Weave repository format 6
85
0 versioned subdirectories
94
self.assertEqual('', err)
95
tree1.commit('commit one')
96
rev = branch1.repository.get_revision(branch1.revision_history()[0])
97
datestring_first = format_date(rev.timestamp, rev.timezone)
99
# Branch standalone with push location
100
branch2 = branch1.bzrdir.sprout('branch').open_branch()
101
branch2.set_push_location(branch1.bzrdir.root_transport.base)
103
out, err = self.run_bzr('info branch')
104
self.assertEqualDiff(
105
"""Standalone tree (format: weave)
110
push branch: standalone
111
parent branch: standalone
113
self.assertEqual('', err)
115
out, err = self.run_bzr('info branch --verbose')
116
self.assertEqualDiff(
117
"""Standalone tree (format: weave)
122
push branch: standalone
123
parent branch: standalone
126
control: All-in-one format 6
127
working tree: Working tree format 2
128
branch: Branch format 4
129
repository: Weave repository format 6
139
0 versioned subdirectories
150
""" % (datestring_first, datestring_first,
152
self.assertEqual('', err)
154
# Branch and bind to standalone, needs upgrade to metadir
155
# (creates backup as unknown)
156
branch1.bzrdir.sprout('bound')
157
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
158
bzrlib.upgrade.upgrade('bound', knit1_format)
159
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
160
branch3.bind(branch1)
161
bound_tree = branch3.bzrdir.open_workingtree()
162
out, err = self.run_bzr('info -v bound')
163
self.assertEqualDiff(
164
"""Checkout (format: knit)
167
checkout of branch: standalone
170
parent branch: standalone
173
control: Meta directory format 1
186
0 versioned subdirectories
197
""" % (bound_tree._format.get_format_description(),
198
branch3._format.get_format_description(),
199
branch3.repository._format.get_format_description(),
200
datestring_first, datestring_first,
202
self.assertEqual('', err)
204
# Checkout standalone (same as above, but does not have parent set)
205
branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
207
branch4.bind(branch1)
208
branch4.bzrdir.open_workingtree().update()
209
out, err = self.run_bzr('info checkout --verbose')
210
self.assertEqualDiff(
211
"""Checkout (format: knit)
213
checkout root: checkout
214
checkout of branch: standalone
217
control: Meta directory format 1
218
working tree: Working tree format 3
219
branch: Branch format 5
230
0 versioned subdirectories
241
""" % (branch4.repository._format.get_format_description(),
242
datestring_first, datestring_first,
244
self.assertEqual('', err)
246
# Lightweight checkout (same as above, different branch and repository)
247
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
248
branch5 = tree5.branch
249
out, err = self.run_bzr('info -v lightcheckout')
250
self.assertEqualDiff(
251
"""Lightweight checkout (format: dirstate or dirstate-tags or \
252
pack-0.92 or rich-root or rich-root-pack or stacked or stacked-rich-root)
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: dirstate or dirstate-tags or \
419
pack-0.92 or rich-root or rich-root-pack or stacked or stacked-rich-root)
421
light checkout root: lightcheckout
422
checkout of branch: standalone
425
control: Meta directory format 1
426
working tree: Working tree format 4
427
branch: Branch format 4
428
repository: Weave repository format 6
430
Working tree is out of date: missing 1 revision.
440
0 versioned subdirectories
451
""" % (datestring_first, datestring_last,), out)
452
self.assertEqual('', err)
454
def test_info_standalone_no_tree(self):
455
# create standalone branch without a working tree
456
format = bzrdir.format_registry.make_bzrdir('default')
457
branch = self.make_branch('branch')
458
repo = branch.repository
459
out, err = self.run_bzr('info branch -v')
460
self.assertEqualDiff(
461
"""Standalone branch (format: %s)
466
control: Meta directory format 1
476
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
477
format.get_branch_format().get_format_description(),
478
format.repository_format.get_format_description(),
480
self.assertEqual('', err)
482
def test_info_shared_repository(self):
483
format = bzrdir.format_registry.make_bzrdir('knit')
484
transport = self.get_transport()
486
# Create shared repository
487
repo = self.make_repository('repo', shared=True, format=format)
488
repo.set_make_working_trees(False)
489
out, err = self.run_bzr('info -v repo')
490
self.assertEqualDiff(
491
"""Shared repository (format: dirstate or dirstate-tags or knit)
493
shared repository: %s
496
control: Meta directory format 1
501
""" % ('repo', format.repository_format.get_format_description(),
503
self.assertEqual('', err)
505
# Create branch inside shared repository
506
repo.bzrdir.root_transport.mkdir('branch')
507
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
509
out, err = self.run_bzr('info -v repo/branch')
510
self.assertEqualDiff(
511
"""Repository branch (format: dirstate or knit)
513
shared repository: repo
514
repository branch: repo/branch
517
control: Meta directory format 1
527
""" % (format.get_branch_format().get_format_description(),
528
format.repository_format.get_format_description(),
530
self.assertEqual('', err)
532
# Create lightweight checkout
533
transport.mkdir('tree')
534
transport.mkdir('tree/lightcheckout')
535
tree2 = branch1.create_checkout('tree/lightcheckout',
537
branch2 = tree2.branch
538
self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
539
shared_repo=repo, repo_branch=branch1, verbose=True)
541
# Create normal checkout
542
tree3 = branch1.create_checkout('tree/checkout')
543
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
545
light_checkout=False, repo_branch=branch1)
546
# Update lightweight checkout
547
self.build_tree(['tree/lightcheckout/a'])
549
tree2.commit('commit one')
550
rev = repo.get_revision(branch2.revision_history()[0])
551
datestring_first = format_date(rev.timestamp, rev.timezone)
552
out, err = self.run_bzr('info tree/lightcheckout --verbose')
553
self.assertEqualDiff(
554
"""Lightweight checkout (format: dirstate or dirstate-tags or \
555
pack-0.92 or rich-root or rich-root-pack or stacked or stacked-rich-root)
557
light checkout root: tree/lightcheckout
558
checkout of branch: repo/branch
559
shared repository: repo
562
control: Meta directory format 1
563
working tree: Working tree format 4
575
0 versioned subdirectories
586
""" % (format.get_branch_format().get_format_description(),
587
format.repository_format.get_format_description(),
588
datestring_first, datestring_first,
590
self.assertEqual('', err)
592
# Out of date checkout
593
out, err = self.run_bzr('info -v tree/checkout')
594
self.assertEqualDiff(
595
"""Checkout (format: dirstate)
597
checkout root: tree/checkout
598
checkout of branch: repo/branch
601
control: Meta directory format 1
602
working tree: Working tree format 4
606
Branch is out of date: missing 1 revision.
616
0 versioned subdirectories
624
""" % (format.get_branch_format().get_format_description(),
625
format.repository_format.get_format_description(),
627
self.assertEqual('', err)
631
self.build_tree(['tree/checkout/b'])
633
out, err = self.run_bzr('info tree/checkout --verbose')
634
self.assertEqualDiff(
635
"""Checkout (format: dirstate)
637
checkout root: tree/checkout
638
checkout of branch: repo/branch
641
control: Meta directory format 1
642
working tree: Working tree format 4
654
0 versioned subdirectories
665
""" % (format.get_branch_format().get_format_description(),
666
format.repository_format.get_format_description(),
667
datestring_first, datestring_first,
669
self.assertEqual('', err)
670
tree3.commit('commit two')
672
# Out of date lightweight checkout
673
rev = repo.get_revision(branch1.revision_history()[-1])
674
datestring_last = format_date(rev.timestamp, rev.timezone)
675
out, err = self.run_bzr('info tree/lightcheckout --verbose')
676
self.assertEqualDiff(
677
"""Lightweight checkout (format: dirstate or dirstate-tags or \
678
pack-0.92 or rich-root or rich-root-pack or stacked or stacked-rich-root)
680
light checkout root: tree/lightcheckout
681
checkout of branch: repo/branch
682
shared repository: repo
685
control: Meta directory format 1
686
working tree: Working tree format 4
690
Working tree is out of date: missing 1 revision.
700
0 versioned subdirectories
711
""" % (format.get_branch_format().get_format_description(),
712
format.repository_format.get_format_description(),
713
datestring_first, datestring_last,
715
self.assertEqual('', err)
717
# Show info about shared branch
718
out, err = self.run_bzr('info repo/branch --verbose')
719
self.assertEqualDiff(
720
"""Repository branch (format: dirstate or knit)
722
shared repository: repo
723
repository branch: repo/branch
726
control: Meta directory format 1
739
""" % (format.get_branch_format().get_format_description(),
740
format.repository_format.get_format_description(),
741
datestring_first, datestring_last,
743
self.assertEqual('', err)
745
# Show info about repository with revisions
746
out, err = self.run_bzr('info -v repo')
747
self.assertEqualDiff(
748
"""Shared repository (format: dirstate or dirstate-tags or knit)
750
shared repository: repo
753
control: Meta directory format 1
758
""" % (format.repository_format.get_format_description(),
760
self.assertEqual('', err)
762
def test_info_shared_repository_with_trees(self):
763
format = bzrdir.format_registry.make_bzrdir('knit')
764
transport = self.get_transport()
766
# Create shared repository with working trees
767
repo = self.make_repository('repo', shared=True, format=format)
768
repo.set_make_working_trees(True)
769
out, err = self.run_bzr('info -v repo')
770
self.assertEqualDiff(
771
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
773
shared repository: repo
776
control: Meta directory format 1
779
Create working tree for new branches inside the repository.
783
""" % (format.repository_format.get_format_description(),
785
self.assertEqual('', err)
787
# Create two branches
788
repo.bzrdir.root_transport.mkdir('branch1')
789
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
791
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
794
out, err = self.run_bzr('info repo/branch1 --verbose')
795
self.assertEqualDiff(
796
"""Repository tree (format: knit)
798
shared repository: repo
799
repository branch: repo/branch1
802
control: Meta directory format 1
803
working tree: Working tree format 3
815
0 versioned subdirectories
823
""" % (format.get_branch_format().get_format_description(),
824
format.repository_format.get_format_description(),
826
self.assertEqual('', err)
828
# Update first branch
829
self.build_tree(['repo/branch1/a'])
830
tree1 = branch1.bzrdir.open_workingtree()
832
tree1.commit('commit one')
833
rev = repo.get_revision(branch1.revision_history()[0])
834
datestring_first = format_date(rev.timestamp, rev.timezone)
835
out, err = self.run_bzr('info -v repo/branch1')
836
self.assertEqualDiff(
837
"""Repository tree (format: knit)
839
shared repository: repo
840
repository branch: repo/branch1
843
control: Meta directory format 1
844
working tree: Working tree format 3
856
0 versioned subdirectories
867
""" % (format.get_branch_format().get_format_description(),
868
format.repository_format.get_format_description(),
869
datestring_first, datestring_first,
871
self.assertEqual('', err)
873
# Out of date second branch
874
out, err = self.run_bzr('info repo/branch2 --verbose')
875
self.assertEqualDiff(
876
"""Repository tree (format: knit)
878
shared repository: repo
879
repository branch: repo/branch2
882
parent branch: repo/branch1
885
control: Meta directory format 1
886
working tree: Working tree format 3
898
0 versioned subdirectories
906
""" % (format.get_branch_format().get_format_description(),
907
format.repository_format.get_format_description(),
909
self.assertEqual('', err)
911
# Update second branch
912
tree2 = branch2.bzrdir.open_workingtree()
914
out, err = self.run_bzr('info -v repo/branch2')
915
self.assertEqualDiff(
916
"""Repository tree (format: knit)
918
shared repository: repo
919
repository branch: repo/branch2
922
parent branch: repo/branch1
925
control: Meta directory format 1
926
working tree: Working tree format 3
938
0 versioned subdirectories
949
""" % (format.get_branch_format().get_format_description(),
950
format.repository_format.get_format_description(),
951
datestring_first, datestring_first,
953
self.assertEqual('', err)
955
# Show info about repository with revisions
956
out, err = self.run_bzr('info -v repo')
957
self.assertEqualDiff(
958
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
960
shared repository: repo
963
control: Meta directory format 1
966
Create working tree for new branches inside the repository.
970
""" % (format.repository_format.get_format_description(),
973
self.assertEqual('', err)
975
def test_info_shared_repository_with_tree_in_root(self):
976
format = bzrdir.format_registry.make_bzrdir('knit')
977
transport = self.get_transport()
979
# Create shared repository with working trees
980
repo = self.make_repository('repo', shared=True, format=format)
981
repo.set_make_working_trees(True)
982
out, err = self.run_bzr('info -v repo')
983
self.assertEqualDiff(
984
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
986
shared repository: repo
989
control: Meta directory format 1
992
Create working tree for new branches inside the repository.
996
""" % (format.repository_format.get_format_description(),
998
self.assertEqual('', err)
1000
# Create branch in root of repository
1001
control = repo.bzrdir
1002
branch = control.create_branch()
1003
control.create_workingtree()
1004
out, err = self.run_bzr('info -v repo')
1005
self.assertEqualDiff(
1006
"""Repository tree (format: knit)
1008
shared repository: repo
1009
repository branch: repo
1012
control: Meta directory format 1
1013
working tree: Working tree format 3
1017
In the working tree:
1025
0 versioned subdirectories
1033
""" % (format.get_branch_format().get_format_description(),
1034
format.repository_format.get_format_description(),
1036
self.assertEqual('', err)
1038
def assertCheckoutStatusOutput(self,
1039
command_string, lco_tree, shared_repo=None,
1042
branch_locked=False, repo_locked=False,
1044
light_checkout=True,
1045
checkout_root=None):
1046
"""Check the output of info in a checkout.
1048
This is not quite a mirror of the info code: rather than using the
1049
tree being examined to predict output, it uses a bunch of flags which
1050
allow us, the test writers, to document what *should* be present in
1051
the output. Removing this separation would remove the value of the
1054
:param path: the path to the light checkout.
1055
:param lco_tree: the tree object for the light checkout.
1056
:param shared_repo: A shared repository is in use, expect that in
1058
:param repo_branch: A branch in a shared repository for non light
1060
:param tree_locked: If true, expect the tree to be locked.
1061
:param branch_locked: If true, expect the branch to be locked.
1062
:param repo_locked: If true, expect the repository to be locked.
1063
Note that the lco_tree.branch.repository is inspected, and if is not
1064
actually locked then this parameter is overridden. This is because
1065
pack repositories do not have any public API for obtaining an
1066
exclusive repository wide lock.
1067
:param verbose: If true, expect verbose output
1069
def friendly_location(url):
1070
path = urlutils.unescape_for_display(url, 'ascii')
1072
return osutils.relpath(osutils.getcwd(), path)
1073
except errors.PathNotChild:
1077
# We expect this to fail because of locking errors.
1078
# (A write-locked file cannot be read-locked
1079
# in the different process -- either on win32 or on linux).
1080
# This should be removed when the locking errors are fixed.
1081
self.expectFailure('OS locks are exclusive '
1082
'for different processes (Bug #174055)',
1083
self.run_bzr_subprocess,
1084
'info ' + command_string)
1085
out, err = self.run_bzr('info %s' % command_string)
1087
(True, True): 'Lightweight checkout',
1088
(True, False): 'Repository checkout',
1089
(False, True): 'Lightweight checkout',
1090
(False, False): 'Checkout',
1091
}[(shared_repo is not None, light_checkout)]
1092
format = {True: 'dirstate or dirstate-tags or pack-0.92'
1093
' or rich-root or rich-root-pack'
1094
' or stacked or stacked-rich-root',
1095
False: 'dirstate'}[light_checkout]
1097
repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1098
if repo_locked or branch_locked or tree_locked:
1099
def locked_message(a_bool):
1104
expected_lock_output = (
1107
" working tree: %s\n"
1109
" repository: %s\n" % (
1110
locked_message(tree_locked),
1111
locked_message(branch_locked),
1112
locked_message(repo_locked)))
1114
expected_lock_output = ''
1118
tree_data = (" light checkout root: %s\n" %
1119
friendly_location(lco_tree.bzrdir.root_transport.base))
1121
if lco_tree.branch.get_bound_location() is not None:
1122
tree_data += ("%s checkout root: %s\n" % (extra_space,
1123
friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1124
if shared_repo is not None:
1126
" checkout of branch: %s\n"
1127
" shared repository: %s\n" %
1128
(friendly_location(repo_branch.bzrdir.root_transport.base),
1129
friendly_location(shared_repo.bzrdir.root_transport.base)))
1130
elif repo_branch is not None:
1132
"%s checkout of branch: %s\n" %
1134
friendly_location(repo_branch.bzrdir.root_transport.base)))
1136
branch_data = (" checkout of branch: %s\n" %
1137
lco_tree.branch.bzrdir.root_transport.base)
1140
verbose_info = ' 0 committers\n'
1144
self.assertEqualDiff(
1149
control: Meta directory format 1
1154
In the working tree:
1162
0 versioned subdirectories
1173
lco_tree._format.get_format_description(),
1174
lco_tree.branch._format.get_format_description(),
1175
lco_tree.branch.repository._format.get_format_description(),
1176
expected_lock_output,
1179
self.assertEqual('', err)
1181
def test_info_locking(self):
1182
transport = self.get_transport()
1183
# Create shared repository with a branch
1184
repo = self.make_repository('repo', shared=True,
1185
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1186
repo.set_make_working_trees(False)
1187
repo.bzrdir.root_transport.mkdir('branch')
1188
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1189
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1190
# Do a heavy checkout
1191
transport.mkdir('tree')
1192
transport.mkdir('tree/checkout')
1193
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1194
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1195
co_branch.bind(repo_branch)
1196
# Do a light checkout of the heavy one
1197
transport.mkdir('tree/lightcheckout')
1198
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1199
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1200
lco_dir.create_workingtree()
1201
lco_tree = lco_dir.open_workingtree()
1203
# Test all permutations of locking the working tree, branch and repository
1207
self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1208
repo_branch=repo_branch,
1209
verbose=True, light_checkout=True)
1211
lco_tree.branch.repository.lock_write()
1213
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1214
lco_tree, repo_branch=repo_branch,
1215
repo_locked=True, verbose=True, light_checkout=True)
1217
lco_tree.branch.repository.unlock()
1219
lco_tree.branch.lock_write()
1221
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1225
repo_branch=repo_branch,
1228
lco_tree.branch.unlock()
1230
lco_tree.lock_write()
1232
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1233
lco_tree, repo_branch=repo_branch,
1241
lco_tree.lock_write()
1242
lco_tree.branch.repository.unlock()
1244
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1245
lco_tree, repo_branch=repo_branch,
1250
lco_tree.branch.repository.lock_write()
1253
lco_tree.lock_write()
1254
lco_tree.branch.unlock()
1256
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1257
lco_tree, repo_branch=repo_branch,
1261
lco_tree.branch.lock_write()
1264
lco_tree.lock_write()
1265
lco_tree.branch.unlock()
1266
lco_tree.branch.repository.lock_write()
1268
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1269
lco_tree, repo_branch=repo_branch,
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('-v tree/lightcheckout',
1282
lco_tree, repo_branch=repo_branch,
1286
lco_tree.branch.repository.lock_write()
1287
lco_tree.branch.unlock()
1289
if sys.platform == 'win32':
1290
self.knownFailure('Win32 cannot run "bzr info"'
1291
' when the tree is locked.')
1293
def test_info_locking_oslocks(self):
1294
if sys.platform == "win32":
1295
raise TestSkipped("don't use oslocks on win32 in unix manner")
1297
tree = self.make_branch_and_tree('branch',
1298
format=bzrlib.bzrdir.BzrDirFormat6())
1300
# Test all permutations of locking the working tree, branch and repository
1301
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1302
# implemented by raising NotImplementedError and get_physical_lock_status()
1303
# always returns false. This makes bzr info hide the lock status. (Olaf)
1307
out, err = self.run_bzr('info -v branch')
1308
self.assertEqualDiff(
1309
"""Standalone tree (format: weave)
1314
control: All-in-one format 6
1315
working tree: Working tree format 2
1316
branch: Branch format 4
1319
In the working tree:
1327
0 versioned subdirectories
1335
""" % ('branch', tree.branch.repository._format.get_format_description(),
1337
self.assertEqual('', err)
1340
out, err = self.run_bzr('info -v branch')
1341
self.assertEqualDiff(
1342
"""Standalone tree (format: weave)
1347
control: All-in-one format 6
1348
working tree: Working tree format 2
1349
branch: Branch format 4
1352
In the working tree:
1360
0 versioned subdirectories
1368
""" % ('branch', tree.branch.repository._format.get_format_description(),
1370
self.assertEqual('', err)
1373
def test_info_stacked(self):
1374
# We have a mainline
1375
trunk_tree = self.make_branch_and_tree('mainline',
1376
format='development1')
1377
trunk_tree.commit('mainline')
1378
# and a branch from it which is stacked
1379
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1380
out, err = self.run_bzr('info newbranch')
1382
"""Standalone tree (format: development1)
1384
branch root: newbranch
1387
parent branch: mainline
1388
stacked on: mainline
1390
self.assertEqual("", err)