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 = (
41
"1.6 or 1.6.1-rich-root "
42
"or 1.9 or 1.9-rich-root "
43
"or dirstate or dirstate-tags or "
44
"pack-0.92 or rich-root or rich-root-pack")
46
def test_info_non_existing(self):
47
if sys.platform == "win32":
48
location = "C:/i/do/not/exist/"
50
location = "/i/do/not/exist/"
51
out, err = self.run_bzr('info '+location, retcode=3)
52
self.assertEqual(out, '')
53
self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
55
def test_info_standalone(self):
56
transport = self.get_transport()
58
# Create initial standalone branch
59
tree1 = self.make_branch_and_tree('standalone', 'weave')
60
self.build_tree(['standalone/a'])
62
branch1 = tree1.branch
64
out, err = self.run_bzr('info standalone')
66
"""Standalone tree (format: weave)
68
branch root: standalone
70
self.assertEqual('', err)
72
# Standalone branch - verbose mode
73
out, err = self.run_bzr('info standalone -v')
75
"""Standalone tree (format: weave)
77
branch root: standalone
80
control: All-in-one format 6
81
working tree: Working tree format 2
82
branch: Branch format 4
83
repository: Weave repository format 6
93
0 versioned subdirectories
101
self.assertEqual('', err)
103
# Standalone branch - really verbose mode
104
out, err = self.run_bzr('info standalone -vv')
105
self.assertEqualDiff(
106
"""Standalone tree (format: weave)
108
branch root: standalone
111
control: All-in-one format 6
112
working tree: Working tree format 2
113
branch: Branch format 4
114
repository: Weave repository format 6
124
0 versioned subdirectories
133
self.assertEqual('', err)
134
tree1.commit('commit one')
135
rev = branch1.repository.get_revision(branch1.revision_history()[0])
136
datestring_first = format_date(rev.timestamp, rev.timezone)
138
# Branch standalone with push location
139
branch2 = branch1.bzrdir.sprout('branch').open_branch()
140
branch2.set_push_location(branch1.bzrdir.root_transport.base)
142
out, err = self.run_bzr('info branch')
143
self.assertEqualDiff(
144
"""Standalone tree (format: weave)
149
push branch: standalone
150
parent branch: standalone
152
self.assertEqual('', err)
154
out, err = self.run_bzr('info branch --verbose')
155
self.assertEqualDiff(
156
"""Standalone tree (format: weave)
161
push branch: standalone
162
parent branch: standalone
165
control: All-in-one format 6
166
working tree: Working tree format 2
167
branch: Branch format 4
168
repository: Weave repository format 6
178
0 versioned subdirectories
188
""" % (datestring_first, datestring_first,
190
self.assertEqual('', err)
192
# Branch and bind to standalone, needs upgrade to metadir
193
# (creates backup as unknown)
194
branch1.bzrdir.sprout('bound')
195
knit1_format = bzrdir.format_registry.make_bzrdir('knit')
196
upgrade.upgrade('bound', knit1_format)
197
branch3 = bzrdir.BzrDir.open('bound').open_branch()
198
branch3.bind(branch1)
199
bound_tree = branch3.bzrdir.open_workingtree()
200
out, err = self.run_bzr('info -v bound')
201
self.assertEqualDiff(
202
"""Checkout (format: knit)
205
checkout of branch: standalone
208
parent branch: standalone
211
control: Meta directory format 1
224
0 versioned subdirectories
234
""" % (bound_tree._format.get_format_description(),
235
branch3._format.get_format_description(),
236
branch3.repository._format.get_format_description(),
237
datestring_first, datestring_first,
239
self.assertEqual('', err)
241
# Checkout standalone (same as above, but does not have parent set)
242
branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
244
branch4.bind(branch1)
245
branch4.bzrdir.open_workingtree().update()
246
out, err = self.run_bzr('info checkout --verbose')
247
self.assertEqualDiff(
248
"""Checkout (format: knit)
250
checkout root: checkout
251
checkout of branch: standalone
254
control: Meta directory format 1
255
working tree: Working tree format 3
256
branch: Branch format 5
267
0 versioned subdirectories
277
""" % (branch4.repository._format.get_format_description(),
278
datestring_first, datestring_first,
280
self.assertEqual('', err)
282
# Lightweight checkout (same as above, different branch and repository)
283
tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
284
branch5 = tree5.branch
285
out, err = self.run_bzr('info -v lightcheckout')
286
self.assertEqualDiff(
287
"""Lightweight checkout (format: %s)
289
light checkout root: lightcheckout
290
checkout of branch: standalone
293
control: Meta directory format 1
294
working tree: Working tree format 4
295
branch: Branch format 4
296
repository: Weave repository format 6
306
0 versioned subdirectories
316
""" % (self._repo_strings, datestring_first, datestring_first,), out)
317
self.assertEqual('', err)
319
# Update initial standalone branch
320
self.build_tree(['standalone/b'])
322
tree1.commit('commit two')
323
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
324
datestring_last = format_date(rev.timestamp, rev.timezone)
326
# Out of date branched standalone branch will not be detected
327
out, err = self.run_bzr('info -v branch')
328
self.assertEqualDiff(
329
"""Standalone tree (format: weave)
334
push branch: standalone
335
parent branch: standalone
338
control: All-in-one format 6
339
working tree: Working tree format 2
340
branch: Branch format 4
341
repository: Weave repository format 6
351
0 versioned subdirectories
361
""" % (datestring_first, datestring_first,
363
self.assertEqual('', err)
365
# Out of date bound branch
366
out, err = self.run_bzr('info -v bound')
367
self.assertEqualDiff(
368
"""Checkout (format: knit)
371
checkout of branch: standalone
374
parent branch: standalone
377
control: Meta directory format 1
378
working tree: Working tree format 3
379
branch: Branch format 5
382
Branch is out of date: missing 1 revision.
392
0 versioned subdirectories
402
""" % (branch3.repository._format.get_format_description(),
403
datestring_first, datestring_first,
405
self.assertEqual('', err)
407
# Out of date checkout
408
out, err = self.run_bzr('info -v checkout')
409
self.assertEqualDiff(
410
"""Checkout (format: knit)
412
checkout root: checkout
413
checkout of branch: standalone
416
control: Meta directory format 1
417
working tree: Working tree format 3
418
branch: Branch format 5
421
Branch is out of date: missing 1 revision.
431
0 versioned subdirectories
441
""" % (branch4.repository._format.get_format_description(),
442
datestring_first, datestring_first,
444
self.assertEqual('', err)
446
# Out of date lightweight checkout
447
out, err = self.run_bzr('info lightcheckout --verbose')
448
self.assertEqualDiff(
449
"""Lightweight checkout (format: %s)
451
light checkout root: lightcheckout
452
checkout of branch: standalone
455
control: Meta directory format 1
456
working tree: Working tree format 4
457
branch: Branch format 4
458
repository: Weave repository format 6
460
Working tree is out of date: missing 1 revision.
470
0 versioned subdirectories
480
""" % (self._repo_strings, datestring_first, datestring_last,), out)
481
self.assertEqual('', err)
483
def test_info_standalone_no_tree(self):
484
# create standalone branch without a working tree
485
format = bzrdir.format_registry.make_bzrdir('default')
486
branch = self.make_branch('branch')
487
repo = branch.repository
488
out, err = self.run_bzr('info branch -v')
489
self.assertEqualDiff(
490
"""Standalone branch (format: %s)
495
control: Meta directory format 1
504
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
505
format.get_branch_format().get_format_description(),
506
format.repository_format.get_format_description(),
508
self.assertEqual('', err)
510
def test_info_shared_repository(self):
511
format = bzrdir.format_registry.make_bzrdir('knit')
512
transport = self.get_transport()
514
# Create shared repository
515
repo = self.make_repository('repo', shared=True, format=format)
516
repo.set_make_working_trees(False)
517
out, err = self.run_bzr('info -v repo')
518
self.assertEqualDiff(
519
"""Shared repository (format: dirstate or dirstate-tags or knit)
521
shared repository: %s
524
control: Meta directory format 1
529
""" % ('repo', format.repository_format.get_format_description(),
531
self.assertEqual('', err)
533
# Create branch inside shared repository
534
repo.bzrdir.root_transport.mkdir('branch')
535
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
537
out, err = self.run_bzr('info -v repo/branch')
538
self.assertEqualDiff(
539
"""Repository branch (format: dirstate or knit)
541
shared repository: repo
542
repository branch: repo/branch
545
control: Meta directory format 1
554
""" % (format.get_branch_format().get_format_description(),
555
format.repository_format.get_format_description(),
557
self.assertEqual('', err)
559
# Create lightweight checkout
560
transport.mkdir('tree')
561
transport.mkdir('tree/lightcheckout')
562
tree2 = branch1.create_checkout('tree/lightcheckout',
564
branch2 = tree2.branch
565
self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
566
shared_repo=repo, repo_branch=branch1, verbose=True)
568
# Create normal checkout
569
tree3 = branch1.create_checkout('tree/checkout')
570
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
572
light_checkout=False, repo_branch=branch1)
573
# Update lightweight checkout
574
self.build_tree(['tree/lightcheckout/a'])
576
tree2.commit('commit one')
577
rev = repo.get_revision(branch2.revision_history()[0])
578
datestring_first = format_date(rev.timestamp, rev.timezone)
579
out, err = self.run_bzr('info tree/lightcheckout --verbose')
580
self.assertEqualDiff(
581
"""Lightweight checkout (format: %s)
583
light checkout root: tree/lightcheckout
584
checkout of branch: repo/branch
585
shared repository: repo
588
control: Meta directory format 1
589
working tree: Working tree format 4
601
0 versioned subdirectories
611
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
612
format.repository_format.get_format_description(),
613
datestring_first, datestring_first,
615
self.assertEqual('', err)
617
# Out of date checkout
618
out, err = self.run_bzr('info -v tree/checkout')
619
self.assertEqualDiff(
620
"""Checkout (format: dirstate)
622
checkout root: tree/checkout
623
checkout of branch: repo/branch
626
control: Meta directory format 1
627
working tree: Working tree format 4
631
Branch is out of date: missing 1 revision.
641
0 versioned subdirectories
648
""" % (format.get_branch_format().get_format_description(),
649
format.repository_format.get_format_description(),
651
self.assertEqual('', err)
655
self.build_tree(['tree/checkout/b'])
657
out, err = self.run_bzr('info tree/checkout --verbose')
658
self.assertEqualDiff(
659
"""Checkout (format: dirstate)
661
checkout root: tree/checkout
662
checkout of branch: repo/branch
665
control: Meta directory format 1
666
working tree: Working tree format 4
678
0 versioned subdirectories
688
""" % (format.get_branch_format().get_format_description(),
689
format.repository_format.get_format_description(),
690
datestring_first, datestring_first,
692
self.assertEqual('', err)
693
tree3.commit('commit two')
695
# Out of date lightweight checkout
696
rev = repo.get_revision(branch1.revision_history()[-1])
697
datestring_last = format_date(rev.timestamp, rev.timezone)
698
out, err = self.run_bzr('info tree/lightcheckout --verbose')
699
self.assertEqualDiff(
700
"""Lightweight checkout (format: %s)
702
light checkout root: tree/lightcheckout
703
checkout of branch: repo/branch
704
shared repository: repo
707
control: Meta directory format 1
708
working tree: Working tree format 4
712
Working tree is out of date: missing 1 revision.
722
0 versioned subdirectories
732
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
733
format.repository_format.get_format_description(),
734
datestring_first, datestring_last,
736
self.assertEqual('', err)
738
# Show info about shared branch
739
out, err = self.run_bzr('info repo/branch --verbose')
740
self.assertEqualDiff(
741
"""Repository branch (format: dirstate or knit)
743
shared repository: repo
744
repository branch: repo/branch
747
control: Meta directory format 1
759
""" % (format.get_branch_format().get_format_description(),
760
format.repository_format.get_format_description(),
761
datestring_first, datestring_last,
763
self.assertEqual('', err)
765
# Show info about repository with revisions
766
out, err = self.run_bzr('info -v repo')
767
self.assertEqualDiff(
768
"""Shared repository (format: dirstate or dirstate-tags or knit)
770
shared repository: repo
773
control: Meta directory format 1
778
""" % (format.repository_format.get_format_description(),
780
self.assertEqual('', err)
782
def test_info_shared_repository_with_trees(self):
783
format = bzrdir.format_registry.make_bzrdir('knit')
784
transport = self.get_transport()
786
# Create shared repository with working trees
787
repo = self.make_repository('repo', shared=True, format=format)
788
repo.set_make_working_trees(True)
789
out, err = self.run_bzr('info -v repo')
790
self.assertEqualDiff(
791
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
793
shared repository: repo
796
control: Meta directory format 1
799
Create working tree for new branches inside the repository.
803
""" % (format.repository_format.get_format_description(),
805
self.assertEqual('', err)
807
# Create two branches
808
repo.bzrdir.root_transport.mkdir('branch1')
809
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
811
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
814
out, err = self.run_bzr('info repo/branch1 --verbose')
815
self.assertEqualDiff(
816
"""Repository tree (format: knit)
818
shared repository: repo
819
repository branch: repo/branch1
822
control: Meta directory format 1
823
working tree: Working tree format 3
835
0 versioned subdirectories
842
""" % (format.get_branch_format().get_format_description(),
843
format.repository_format.get_format_description(),
845
self.assertEqual('', err)
847
# Update first branch
848
self.build_tree(['repo/branch1/a'])
849
tree1 = branch1.bzrdir.open_workingtree()
851
tree1.commit('commit one')
852
rev = repo.get_revision(branch1.revision_history()[0])
853
datestring_first = format_date(rev.timestamp, rev.timezone)
854
out, err = self.run_bzr('info -v repo/branch1')
855
self.assertEqualDiff(
856
"""Repository tree (format: knit)
858
shared repository: repo
859
repository branch: repo/branch1
862
control: Meta directory format 1
863
working tree: Working tree format 3
875
0 versioned subdirectories
885
""" % (format.get_branch_format().get_format_description(),
886
format.repository_format.get_format_description(),
887
datestring_first, datestring_first,
889
self.assertEqual('', err)
891
# Out of date second branch
892
out, err = self.run_bzr('info repo/branch2 --verbose')
893
self.assertEqualDiff(
894
"""Repository tree (format: knit)
896
shared repository: repo
897
repository branch: repo/branch2
900
parent branch: repo/branch1
903
control: Meta directory format 1
904
working tree: Working tree format 3
916
0 versioned subdirectories
923
""" % (format.get_branch_format().get_format_description(),
924
format.repository_format.get_format_description(),
926
self.assertEqual('', err)
928
# Update second branch
929
tree2 = branch2.bzrdir.open_workingtree()
931
out, err = self.run_bzr('info -v repo/branch2')
932
self.assertEqualDiff(
933
"""Repository tree (format: knit)
935
shared repository: repo
936
repository branch: repo/branch2
939
parent branch: repo/branch1
942
control: Meta directory format 1
943
working tree: Working tree format 3
955
0 versioned subdirectories
965
""" % (format.get_branch_format().get_format_description(),
966
format.repository_format.get_format_description(),
967
datestring_first, datestring_first,
969
self.assertEqual('', err)
971
# Show info about repository with revisions
972
out, err = self.run_bzr('info -v repo')
973
self.assertEqualDiff(
974
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
976
shared repository: repo
979
control: Meta directory format 1
982
Create working tree for new branches inside the repository.
986
""" % (format.repository_format.get_format_description(),
989
self.assertEqual('', err)
991
def test_info_shared_repository_with_tree_in_root(self):
992
format = bzrdir.format_registry.make_bzrdir('knit')
993
transport = self.get_transport()
995
# Create shared repository with working trees
996
repo = self.make_repository('repo', shared=True, format=format)
997
repo.set_make_working_trees(True)
998
out, err = self.run_bzr('info -v repo')
999
self.assertEqualDiff(
1000
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1002
shared repository: repo
1005
control: Meta directory format 1
1008
Create working tree for new branches inside the repository.
1012
""" % (format.repository_format.get_format_description(),
1014
self.assertEqual('', err)
1016
# Create branch in root of repository
1017
control = repo.bzrdir
1018
branch = control.create_branch()
1019
control.create_workingtree()
1020
out, err = self.run_bzr('info -v repo')
1021
self.assertEqualDiff(
1022
"""Repository tree (format: knit)
1024
shared repository: repo
1025
repository branch: repo
1028
control: Meta directory format 1
1029
working tree: Working tree format 3
1033
In the working tree:
1041
0 versioned subdirectories
1048
""" % (format.get_branch_format().get_format_description(),
1049
format.repository_format.get_format_description(),
1051
self.assertEqual('', err)
1053
def test_info_repository_hook(self):
1054
format = bzrdir.format_registry.make_bzrdir('knit')
1055
def repo_info(repo, stats, outf):
1056
outf.write("more info\n")
1057
info.hooks.install_named_hook('repository', repo_info, None)
1058
# Create shared repository with working trees
1059
repo = self.make_repository('repo', shared=True, format=format)
1060
out, err = self.run_bzr('info -v repo')
1061
self.assertEqualDiff(
1062
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1064
shared repository: repo
1067
control: Meta directory format 1
1070
Create working tree for new branches inside the repository.
1075
""" % (format.repository_format.get_format_description(),
1077
self.assertEqual('', err)
1079
def assertCheckoutStatusOutput(self,
1080
command_string, lco_tree, shared_repo=None,
1083
branch_locked=False, repo_locked=False,
1085
light_checkout=True,
1086
checkout_root=None):
1087
"""Check the output of info in a checkout.
1089
This is not quite a mirror of the info code: rather than using the
1090
tree being examined to predict output, it uses a bunch of flags which
1091
allow us, the test writers, to document what *should* be present in
1092
the output. Removing this separation would remove the value of the
1095
:param path: the path to the light checkout.
1096
:param lco_tree: the tree object for the light checkout.
1097
:param shared_repo: A shared repository is in use, expect that in
1099
:param repo_branch: A branch in a shared repository for non light
1101
:param tree_locked: If true, expect the tree to be locked.
1102
:param branch_locked: If true, expect the branch to be locked.
1103
:param repo_locked: If true, expect the repository to be locked.
1104
Note that the lco_tree.branch.repository is inspected, and if is not
1105
actually locked then this parameter is overridden. This is because
1106
pack repositories do not have any public API for obtaining an
1107
exclusive repository wide lock.
1108
:param verbose: verbosity level: 2 or higher to show committers
1110
def friendly_location(url):
1111
path = urlutils.unescape_for_display(url, 'ascii')
1113
return osutils.relpath(osutils.getcwd(), path)
1114
except errors.PathNotChild:
1118
# We expect this to fail because of locking errors.
1119
# (A write-locked file cannot be read-locked
1120
# in the different process -- either on win32 or on linux).
1121
# This should be removed when the locking errors are fixed.
1122
self.expectFailure('OS locks are exclusive '
1123
'for different processes (Bug #174055)',
1124
self.run_bzr_subprocess,
1125
'info ' + command_string)
1126
out, err = self.run_bzr('info %s' % command_string)
1128
(True, True): 'Lightweight checkout',
1129
(True, False): 'Repository checkout',
1130
(False, True): 'Lightweight checkout',
1131
(False, False): 'Checkout',
1132
}[(shared_repo is not None, light_checkout)]
1133
format = {True: self._repo_strings,
1134
False: 'dirstate'}[light_checkout]
1136
repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1137
if repo_locked or branch_locked or tree_locked:
1138
def locked_message(a_bool):
1143
expected_lock_output = (
1146
" working tree: %s\n"
1148
" repository: %s\n" % (
1149
locked_message(tree_locked),
1150
locked_message(branch_locked),
1151
locked_message(repo_locked)))
1153
expected_lock_output = ''
1157
tree_data = (" light checkout root: %s\n" %
1158
friendly_location(lco_tree.bzrdir.root_transport.base))
1160
if lco_tree.branch.get_bound_location() is not None:
1161
tree_data += ("%s checkout root: %s\n" % (extra_space,
1162
friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1163
if shared_repo is not None:
1165
" checkout of branch: %s\n"
1166
" shared repository: %s\n" %
1167
(friendly_location(repo_branch.bzrdir.root_transport.base),
1168
friendly_location(shared_repo.bzrdir.root_transport.base)))
1169
elif repo_branch is not None:
1171
"%s checkout of branch: %s\n" %
1173
friendly_location(repo_branch.bzrdir.root_transport.base)))
1175
branch_data = (" checkout of branch: %s\n" %
1176
lco_tree.branch.bzrdir.root_transport.base)
1179
verbose_info = ' 0 committers\n'
1183
self.assertEqualDiff(
1188
control: Meta directory format 1
1193
In the working tree:
1201
0 versioned subdirectories
1212
lco_tree._format.get_format_description(),
1213
lco_tree.branch._format.get_format_description(),
1214
lco_tree.branch.repository._format.get_format_description(),
1215
expected_lock_output,
1218
self.assertEqual('', err)
1220
def test_info_locking(self):
1221
transport = self.get_transport()
1222
# Create shared repository with a branch
1223
repo = self.make_repository('repo', shared=True,
1224
format=bzrdir.BzrDirMetaFormat1())
1225
repo.set_make_working_trees(False)
1226
repo.bzrdir.root_transport.mkdir('branch')
1227
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1228
format=bzrdir.BzrDirMetaFormat1())
1229
# Do a heavy checkout
1230
transport.mkdir('tree')
1231
transport.mkdir('tree/checkout')
1232
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1233
format=bzrdir.BzrDirMetaFormat1())
1234
co_branch.bind(repo_branch)
1235
# Do a light checkout of the heavy one
1236
transport.mkdir('tree/lightcheckout')
1237
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1238
branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1239
lco_dir.create_workingtree()
1240
lco_tree = lco_dir.open_workingtree()
1242
# Test all permutations of locking the working tree, branch and repository
1246
self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1247
repo_branch=repo_branch,
1248
verbose=True, light_checkout=True)
1250
lco_tree.branch.repository.lock_write()
1252
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1253
lco_tree, repo_branch=repo_branch,
1254
repo_locked=True, verbose=True, light_checkout=True)
1256
lco_tree.branch.repository.unlock()
1258
lco_tree.branch.lock_write()
1260
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1264
repo_branch=repo_branch,
1267
lco_tree.branch.unlock()
1269
lco_tree.lock_write()
1271
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1272
lco_tree, repo_branch=repo_branch,
1280
lco_tree.lock_write()
1281
lco_tree.branch.repository.unlock()
1283
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1284
lco_tree, repo_branch=repo_branch,
1289
lco_tree.branch.repository.lock_write()
1292
lco_tree.lock_write()
1293
lco_tree.branch.unlock()
1295
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1296
lco_tree, repo_branch=repo_branch,
1300
lco_tree.branch.lock_write()
1303
lco_tree.lock_write()
1304
lco_tree.branch.unlock()
1305
lco_tree.branch.repository.lock_write()
1307
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1308
lco_tree, repo_branch=repo_branch,
1313
lco_tree.branch.repository.unlock()
1314
lco_tree.branch.lock_write()
1317
lco_tree.branch.lock_write()
1318
lco_tree.branch.repository.unlock()
1320
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1321
lco_tree, repo_branch=repo_branch,
1325
lco_tree.branch.repository.lock_write()
1326
lco_tree.branch.unlock()
1328
if sys.platform == 'win32':
1329
self.knownFailure('Win32 cannot run "bzr info"'
1330
' when the tree is locked.')
1332
def test_info_locking_oslocks(self):
1333
if sys.platform == "win32":
1334
raise TestSkipped("don't use oslocks on win32 in unix manner")
1335
self.thisFailsStrictLockCheck()
1337
tree = self.make_branch_and_tree('branch',
1338
format=bzrdir.BzrDirFormat6())
1340
# Test all permutations of locking the working tree, branch and repository
1341
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1342
# implemented by raising NotImplementedError and get_physical_lock_status()
1343
# always returns false. This makes bzr info hide the lock status. (Olaf)
1347
out, err = self.run_bzr('info -v branch')
1348
self.assertEqualDiff(
1349
"""Standalone tree (format: weave)
1354
control: All-in-one format 6
1355
working tree: Working tree format 2
1356
branch: Branch format 4
1359
In the working tree:
1367
0 versioned subdirectories
1374
""" % ('branch', tree.branch.repository._format.get_format_description(),
1376
self.assertEqual('', err)
1379
out, err = self.run_bzr('info -v branch')
1380
self.assertEqualDiff(
1381
"""Standalone tree (format: weave)
1386
control: All-in-one format 6
1387
working tree: Working tree format 2
1388
branch: Branch format 4
1391
In the working tree:
1399
0 versioned subdirectories
1406
""" % ('branch', tree.branch.repository._format.get_format_description(),
1408
self.assertEqual('', err)
1411
def test_info_stacked(self):
1412
# We have a mainline
1413
trunk_tree = self.make_branch_and_tree('mainline',
1415
trunk_tree.commit('mainline')
1416
# and a branch from it which is stacked
1417
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1418
out, err = self.run_bzr('info newbranch')
1420
"""Standalone tree (format: 1.6)
1422
branch root: newbranch
1425
parent branch: mainline
1426
stacked on: mainline
1428
self.assertEqual("", err)