1
# Copyright (C) 2006-2010 Canonical Ltd
1
# Copyright (C) 2006 by Canonical Ltd
2
# -*- coding: utf-8 -*-
3
4
# This program is free software; you can redistribute it and/or modify
4
5
# it under the terms of the GNU General Public License as published by
5
6
# the Free Software Foundation; either version 2 of the License, or
6
7
# (at your option) any later version.
8
9
# This program is distributed in the hope that it will be useful,
9
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
12
# GNU General Public License for more details.
13
14
# You should have received a copy of the GNU General Public License
14
15
# along with this program; if not, write to the Free Software
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19
"""Tests for the info command of bzr."""
32
from bzrlib.transport import memory
35
class TestInfo(tests.TestCaseWithTransport):
38
super(TestInfo, self).setUp()
39
self._repo_strings = "2a"
41
def test_info_non_existing(self):
42
self.vfs_transport_factory = memory.MemoryServer
43
location = self.get_url()
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)
25
from bzrlib.osutils import format_date
26
from bzrlib.tests import TestSkipped
27
from bzrlib.tests.blackbox import ExternalBase
30
class TestInfo(ExternalBase):
48
32
def test_info_standalone(self):
49
33
transport = self.get_transport()
51
35
# Create initial standalone branch
52
tree1 = self.make_branch_and_tree('standalone', 'weave')
36
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
37
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirFormat6())
38
tree1 = self.make_branch_and_tree('standalone')
39
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
53
40
self.build_tree(['standalone/a'])
55
42
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
# Standalone branch - verbose mode
66
out, err = self.run_bzr('info standalone -v')
68
"""Standalone tree (format: weave)
70
branch root: standalone
73
control: All-in-one format 6
74
working tree: Working tree format 2
75
branch: Branch format 4
76
repository: Weave repository format 6
86
0 versioned subdirectories
94
self.assertEqual('', err)
96
# Standalone branch - really verbose mode
97
out, err = self.run_bzr('info standalone -vv')
99
"""Standalone tree (format: weave)
101
branch root: standalone
104
control: All-in-one format 6
105
working tree: Working tree format 2
106
branch: Branch format 4
107
repository: Weave repository format 6
117
0 versioned subdirectories
43
out, err = self.runbzr('info standalone')
49
control: All-in-one format 6
50
working tree: Working tree format 2
51
branch: Branch format 4
52
repository: Weave repository format 6
62
0 versioned subdirectories
70
""" % branch1.bzrdir.root_transport.base, out)
126
71
self.assertEqual('', err)
127
72
tree1.commit('commit one')
128
73
rev = branch1.repository.get_revision(branch1.revision_history()[0])
129
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
74
datestring_first = format_date(rev.timestamp, rev.timezone)
131
76
# Branch standalone with push location
132
77
branch2 = branch1.bzrdir.sprout('branch').open_branch()
133
78
branch2.set_push_location(branch1.bzrdir.root_transport.base)
135
out, err = self.run_bzr('info branch')
136
self.assertEqualDiff(
137
"""Standalone tree (format: weave)
142
push branch: standalone
143
parent branch: standalone
145
self.assertEqual('', err)
147
out, err = self.run_bzr('info branch --verbose')
148
self.assertEqualDiff(
149
"""Standalone tree (format: weave)
154
push branch: standalone
155
parent branch: standalone
79
out, err = self.runbzr('info branch --verbose')
158
87
control: All-in-one format 6
468
403
first revision: %s
469
404
latest revision: %s
473
""" % (self._repo_strings, datestring_first, datestring_last,), out)
474
self.assertEqual('', err)
476
def test_info_standalone_no_tree(self):
477
# create standalone branch without a working tree
478
format = bzrdir.format_registry.make_bzrdir('default')
479
branch = self.make_branch('branch')
480
repo = branch.repository
481
out, err = self.run_bzr('info branch -v')
482
self.assertEqualDiff(
483
"""Standalone branch (format: %s)
488
control: Meta directory format 1
497
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
498
format.get_branch_format().get_format_description(),
499
format.repository_format.get_format_description(),
409
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
410
datestring_first, datestring_last), out)
501
411
self.assertEqual('', err)
503
413
def test_info_shared_repository(self):
504
format = bzrdir.format_registry.make_bzrdir('knit')
414
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
415
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
505
416
transport = self.get_transport()
507
418
# Create shared repository
508
repo = self.make_repository('repo', shared=True, format=format)
419
repo = self.make_repository('repo', shared=True)
509
420
repo.set_make_working_trees(False)
510
out, err = self.run_bzr('info -v repo')
421
out, err = self.runbzr('info repo')
511
422
self.assertEqualDiff(
512
"""Shared repository (format: dirstate or dirstate-tags or knit)
514
shared repository: %s
424
shared repository: %s
517
427
control: Meta directory format 1
428
repository: Weave repository format 7
522
""" % ('repo', format.repository_format.get_format_description(),
433
""" % repo.bzrdir.root_transport.base, out)
524
434
self.assertEqual('', err)
526
436
# Create branch inside shared repository
527
437
repo.bzrdir.root_transport.mkdir('branch')
528
branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
530
out, err = self.run_bzr('info -v repo/branch')
438
branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
439
out, err = self.runbzr('info repo/branch')
531
440
self.assertEqualDiff(
532
"""Repository branch (format: dirstate or knit)
534
shared repository: repo
535
repository branch: repo/branch
443
shared repository: %s
538
446
control: Meta directory format 1
447
branch: Branch format 5
448
repository: Weave repository format 7
547
""" % (format.get_branch_format().get_format_description(),
548
format.repository_format.get_format_description(),
456
""" % (branch1.bzrdir.root_transport.base,
457
repo.bzrdir.root_transport.base), out)
550
458
self.assertEqual('', err)
552
460
# Create lightweight checkout
553
461
transport.mkdir('tree')
554
462
transport.mkdir('tree/lightcheckout')
555
tree2 = branch1.create_checkout('tree/lightcheckout',
463
dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
464
bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
465
dir2.create_workingtree()
466
tree2 = dir2.open_workingtree()
557
467
branch2 = tree2.branch
558
self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
559
shared_repo=repo, repo_branch=branch1, verbose=True)
468
out, err = self.runbzr('info tree/lightcheckout')
469
self.assertEqualDiff(
472
checkout of branch: %s
473
shared repository: %s
476
control: Meta directory format 1
477
working tree: Working tree format 3
478
branch: Branch format 5
479
repository: Weave repository format 7
489
0 versioned subdirectories
497
""" % (tree2.bzrdir.root_transport.base,
498
branch1.bzrdir.root_transport.base,
499
repo.bzrdir.root_transport.base), out)
500
self.assertEqual('', err)
561
502
# Create normal checkout
562
tree3 = branch1.create_checkout('tree/checkout')
563
self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
565
light_checkout=False, repo_branch=branch1)
503
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
504
branch3.bind(branch1)
505
tree3 = branch3.bzrdir.open_workingtree()
507
out, err = self.runbzr('info tree/checkout --verbose')
508
self.assertEqualDiff(
514
control: Meta directory format 1
515
working tree: Working tree format 3
516
branch: Branch format 5
517
repository: Weave repository format 7
527
0 versioned subdirectories
536
""" % (branch3.bzrdir.root_transport.base,
537
branch1.bzrdir.root_transport.base), out)
538
self.assertEqual('', err)
566
540
# Update lightweight checkout
567
541
self.build_tree(['tree/lightcheckout/a'])
569
543
tree2.commit('commit one')
570
544
rev = repo.get_revision(branch2.revision_history()[0])
571
datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
572
out, err = self.run_bzr('info tree/lightcheckout --verbose')
545
datestring_first = format_date(rev.timestamp, rev.timezone)
546
out, err = self.runbzr('info tree/lightcheckout --verbose')
573
547
self.assertEqualDiff(
574
"""Lightweight checkout (format: %s)
576
light checkout root: tree/lightcheckout
577
checkout of branch: repo/branch
578
shared repository: repo
550
checkout of branch: %s
551
shared repository: %s
581
554
control: Meta directory format 1
582
working tree: Working tree format 6
555
working tree: Working tree format 3
556
branch: Branch format 5
557
repository: Weave repository format 7
586
559
In the working tree:
720
693
first revision: %s
721
694
latest revision: %s
725
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
726
format.repository_format.get_format_description(),
727
datestring_first, datestring_last,
699
""" % (tree2.bzrdir.root_transport.base,
700
branch1.bzrdir.root_transport.base,
701
repo.bzrdir.root_transport.base,
702
datestring_first, datestring_last), out)
729
703
self.assertEqual('', err)
731
705
# Show info about shared branch
732
out, err = self.run_bzr('info repo/branch --verbose')
706
out, err = self.runbzr('info repo/branch --verbose')
733
707
self.assertEqualDiff(
734
"""Repository branch (format: dirstate or knit)
736
shared repository: repo
737
repository branch: repo/branch
710
shared repository: %s
740
713
control: Meta directory format 1
714
branch: Branch format 5
715
repository: Weave repository format 7
747
721
first revision: %s
748
722
latest revision: %s
752
""" % (format.get_branch_format().get_format_description(),
753
format.repository_format.get_format_description(),
754
datestring_first, datestring_last,
727
""" % (branch1.bzrdir.root_transport.base,
728
repo.bzrdir.root_transport.base,
729
datestring_first, datestring_last), out)
756
730
self.assertEqual('', err)
758
732
# Show info about repository with revisions
759
out, err = self.run_bzr('info -v repo')
733
out, err = self.runbzr('info repo')
760
734
self.assertEqualDiff(
761
"""Shared repository (format: dirstate or dirstate-tags or knit)
763
shared repository: repo
736
shared repository: %s
766
739
control: Meta directory format 1
740
repository: Weave repository format 7
771
""" % (format.repository_format.get_format_description(),
745
""" % repo.bzrdir.root_transport.base, out)
773
746
self.assertEqual('', err)
748
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
775
750
def test_info_shared_repository_with_trees(self):
776
format = bzrdir.format_registry.make_bzrdir('knit')
751
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
752
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
777
753
transport = self.get_transport()
779
755
# Create shared repository with working trees
780
repo = self.make_repository('repo', shared=True, format=format)
756
repo = self.make_repository('repo', shared=True)
781
757
repo.set_make_working_trees(True)
782
out, err = self.run_bzr('info -v repo')
758
out, err = self.runbzr('info repo')
783
759
self.assertEqualDiff(
784
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
786
shared repository: repo
761
shared repository: %s
789
764
control: Meta directory format 1
765
repository: Weave repository format 7
792
767
Create working tree for new branches inside the repository.
796
""" % (format.repository_format.get_format_description(),
772
""" % repo.bzrdir.root_transport.base, out)
798
773
self.assertEqual('', err)
800
775
# Create two branches
801
776
repo.bzrdir.root_transport.mkdir('branch1')
802
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
777
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
804
778
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
806
780
# Empty first branch
807
out, err = self.run_bzr('info repo/branch1 --verbose')
781
out, err = self.runbzr('info repo/branch1 --verbose')
808
782
self.assertEqualDiff(
809
"""Repository tree (format: knit)
811
shared repository: repo
812
repository branch: repo/branch1
785
shared repository: %s
815
788
control: Meta directory format 1
816
789
working tree: Working tree format 3
790
branch: Branch format 5
791
repository: Weave repository format 7
820
793
In the working tree:
953
920
first revision: %s
954
921
latest revision: %s
958
""" % (format.get_branch_format().get_format_description(),
959
format.repository_format.get_format_description(),
960
datestring_first, datestring_first,
926
""" % (branch2.bzrdir.root_transport.base,
927
repo.bzrdir.root_transport.base,
928
branch1.bzrdir.root_transport.base,
929
datestring_first, datestring_first), out)
962
930
self.assertEqual('', err)
964
932
# Show info about repository with revisions
965
out, err = self.run_bzr('info -v repo')
933
out, err = self.runbzr('info repo')
966
934
self.assertEqualDiff(
967
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
969
shared repository: repo
936
shared repository: %s
972
939
control: Meta directory format 1
940
repository: Weave repository format 7
975
942
Create working tree for new branches inside the repository.
979
""" % (format.repository_format.get_format_description(),
982
self.assertEqual('', err)
984
def test_info_shared_repository_with_tree_in_root(self):
985
format = bzrdir.format_registry.make_bzrdir('knit')
986
transport = self.get_transport()
988
# Create shared repository with working trees
989
repo = self.make_repository('repo', shared=True, format=format)
990
repo.set_make_working_trees(True)
991
out, err = self.run_bzr('info -v repo')
992
self.assertEqualDiff(
993
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
995
shared repository: repo
998
control: Meta directory format 1
1001
Create working tree for new branches inside the repository.
1005
""" % (format.repository_format.get_format_description(),
1007
self.assertEqual('', err)
1009
# Create branch in root of repository
1010
control = repo.bzrdir
1011
branch = control.create_branch()
1012
control.create_workingtree()
1013
out, err = self.run_bzr('info -v repo')
1014
self.assertEqualDiff(
1015
"""Repository tree (format: knit)
1017
shared repository: repo
1018
repository branch: repo
1021
control: Meta directory format 1
1022
working tree: Working tree format 3
1026
In the working tree:
1034
0 versioned subdirectories
1041
""" % (format.get_branch_format().get_format_description(),
1042
format.repository_format.get_format_description(),
1044
self.assertEqual('', err)
1046
def test_info_repository_hook(self):
1047
format = bzrdir.format_registry.make_bzrdir('knit')
1048
def repo_info(repo, stats, outf):
1049
outf.write("more info\n")
1050
info.hooks.install_named_hook('repository', repo_info, None)
1051
# Create shared repository with working trees
1052
repo = self.make_repository('repo', shared=True, format=format)
1053
out, err = self.run_bzr('info -v repo')
1054
self.assertEqualDiff(
1055
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1057
shared repository: repo
1060
control: Meta directory format 1
1063
Create working tree for new branches inside the repository.
1068
""" % (format.repository_format.get_format_description(),
1070
self.assertEqual('', err)
1072
def assertCheckoutStatusOutput(self,
1073
command_string, lco_tree, shared_repo=None,
1076
branch_locked=False, repo_locked=False,
1078
light_checkout=True,
1079
checkout_root=None):
1080
"""Check the output of info in a checkout.
1082
This is not quite a mirror of the info code: rather than using the
1083
tree being examined to predict output, it uses a bunch of flags which
1084
allow us, the test writers, to document what *should* be present in
1085
the output. Removing this separation would remove the value of the
1088
:param path: the path to the light checkout.
1089
:param lco_tree: the tree object for the light checkout.
1090
:param shared_repo: A shared repository is in use, expect that in
1092
:param repo_branch: A branch in a shared repository for non light
1094
:param tree_locked: If true, expect the tree to be locked.
1095
:param branch_locked: If true, expect the branch to be locked.
1096
:param repo_locked: If true, expect the repository to be locked.
1097
Note that the lco_tree.branch.repository is inspected, and if is not
1098
actually locked then this parameter is overridden. This is because
1099
pack repositories do not have any public API for obtaining an
1100
exclusive repository wide lock.
1101
:param verbose: verbosity level: 2 or higher to show committers
1103
def friendly_location(url):
1104
path = urlutils.unescape_for_display(url, 'ascii')
1106
return osutils.relpath(osutils.getcwd(), path)
1107
except errors.PathNotChild:
1111
# We expect this to fail because of locking errors.
1112
# (A write-locked file cannot be read-locked
1113
# in the different process -- either on win32 or on linux).
1114
# This should be removed when the locking errors are fixed.
1115
self.expectFailure('OS locks are exclusive '
1116
'for different processes (Bug #174055)',
1117
self.run_bzr_subprocess,
1118
'info ' + command_string)
1119
out, err = self.run_bzr('info %s' % command_string)
1121
(True, True): 'Lightweight checkout',
1122
(True, False): 'Repository checkout',
1123
(False, True): 'Lightweight checkout',
1124
(False, False): 'Checkout',
1125
}[(shared_repo is not None, light_checkout)]
1126
format = {True: self._repo_strings,
1127
False: 'unnamed'}[light_checkout]
1129
repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1130
if repo_locked or branch_locked or tree_locked:
1131
def locked_message(a_bool):
1136
expected_lock_output = (
1139
" working tree: %s\n"
1141
" repository: %s\n" % (
1142
locked_message(tree_locked),
1143
locked_message(branch_locked),
1144
locked_message(repo_locked)))
1146
expected_lock_output = ''
1150
tree_data = (" light checkout root: %s\n" %
1151
friendly_location(lco_tree.bzrdir.root_transport.base))
1153
if lco_tree.branch.get_bound_location() is not None:
1154
tree_data += ("%s checkout root: %s\n" % (extra_space,
1155
friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1156
if shared_repo is not None:
1158
" checkout of branch: %s\n"
1159
" shared repository: %s\n" %
1160
(friendly_location(repo_branch.bzrdir.root_transport.base),
1161
friendly_location(shared_repo.bzrdir.root_transport.base)))
1162
elif repo_branch is not None:
1164
"%s checkout of branch: %s\n" %
1166
friendly_location(repo_branch.bzrdir.root_transport.base)))
1168
branch_data = (" checkout of branch: %s\n" %
1169
lco_tree.branch.bzrdir.root_transport.base)
1172
verbose_info = ' 0 committers\n'
1176
self.assertEqualDiff(
1181
control: Meta directory format 1
1186
In the working tree:
1194
0 versioned subdirectories
1205
lco_tree._format.get_format_description(),
1206
lco_tree.branch._format.get_format_description(),
1207
lco_tree.branch.repository._format.get_format_description(),
1208
expected_lock_output,
1211
self.assertEqual('', err)
1213
def test_info_locking(self):
1214
transport = self.get_transport()
1215
# Create shared repository with a branch
1216
repo = self.make_repository('repo', shared=True,
1217
format=bzrdir.BzrDirMetaFormat1())
1218
repo.set_make_working_trees(False)
1219
repo.bzrdir.root_transport.mkdir('branch')
1220
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
format=bzrdir.BzrDirMetaFormat1())
1222
# Do a heavy checkout
1223
transport.mkdir('tree')
1224
transport.mkdir('tree/checkout')
1225
co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
format=bzrdir.BzrDirMetaFormat1())
1227
co_branch.bind(repo_branch)
1228
# Do a light checkout of the heavy one
1229
transport.mkdir('tree/lightcheckout')
1230
lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
branch.BranchReferenceFormat().initialize(lco_dir,
1232
target_branch=co_branch)
1233
lco_dir.create_workingtree()
1234
lco_tree = lco_dir.open_workingtree()
1236
# Test all permutations of locking the working tree, branch and repository
1240
self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1241
repo_branch=repo_branch,
1242
verbose=True, light_checkout=True)
1244
lco_tree.branch.repository.lock_write()
1246
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1247
lco_tree, repo_branch=repo_branch,
1248
repo_locked=True, verbose=True, light_checkout=True)
1250
lco_tree.branch.repository.unlock()
1252
lco_tree.branch.lock_write()
1254
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1258
repo_branch=repo_branch,
1261
lco_tree.branch.unlock()
1263
lco_tree.lock_write()
1265
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1266
lco_tree, repo_branch=repo_branch,
1274
lco_tree.lock_write()
1275
lco_tree.branch.repository.unlock()
1277
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1278
lco_tree, repo_branch=repo_branch,
1283
lco_tree.branch.repository.lock_write()
1286
lco_tree.lock_write()
1287
lco_tree.branch.unlock()
1289
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1290
lco_tree, repo_branch=repo_branch,
1294
lco_tree.branch.lock_write()
1297
lco_tree.lock_write()
1298
lco_tree.branch.unlock()
1299
lco_tree.branch.repository.lock_write()
1301
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1302
lco_tree, repo_branch=repo_branch,
1307
lco_tree.branch.repository.unlock()
1308
lco_tree.branch.lock_write()
1311
lco_tree.branch.lock_write()
1312
lco_tree.branch.repository.unlock()
1314
self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1315
lco_tree, repo_branch=repo_branch,
1319
lco_tree.branch.repository.lock_write()
1320
lco_tree.branch.unlock()
1322
if sys.platform == 'win32':
1323
self.knownFailure('Win32 cannot run "bzr info"'
1324
' when the tree is locked.')
1326
def test_info_locking_oslocks(self):
1327
if sys.platform == "win32":
1328
self.skip("don't use oslocks on win32 in unix manner")
1329
# This test tests old (all-in-one, OS lock using) behaviour which
1330
# simply cannot work on windows (and is indeed why we changed our
1331
# design. As such, don't try to remove the thisFailsStrictLockCheck
1333
self.thisFailsStrictLockCheck()
1335
tree = self.make_branch_and_tree('branch',
1336
format=bzrdir.BzrDirFormat6())
1338
# Test all permutations of locking the working tree, branch and repository
1339
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1340
# implemented by raising NotImplementedError and get_physical_lock_status()
1341
# always returns false. This makes bzr info hide the lock status. (Olaf)
1345
out, err = self.run_bzr('info -v branch')
1346
self.assertEqualDiff(
1347
"""Standalone tree (format: weave)
1352
control: All-in-one format 6
1353
working tree: Working tree format 2
1354
branch: Branch format 4
1357
In the working tree:
1365
0 versioned subdirectories
1372
""" % ('branch', tree.branch.repository._format.get_format_description(),
1374
self.assertEqual('', err)
1377
out, err = self.run_bzr('info -v branch')
1378
self.assertEqualDiff(
1379
"""Standalone tree (format: weave)
1384
control: All-in-one format 6
1385
working tree: Working tree format 2
1386
branch: Branch format 4
1389
In the working tree:
1397
0 versioned subdirectories
1404
""" % ('branch', tree.branch.repository._format.get_format_description(),
1406
self.assertEqual('', err)
1409
def test_info_stacked(self):
1410
# We have a mainline
1411
trunk_tree = self.make_branch_and_tree('mainline',
1413
trunk_tree.commit('mainline')
1414
# and a branch from it which is stacked
1415
new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1416
out, err = self.run_bzr('info newbranch')
1418
"""Standalone tree (format: 1.6)
1420
branch root: newbranch
1423
parent branch: mainline
1424
stacked on: mainline
1426
self.assertEqual("", err)
947
""" % repo.bzrdir.root_transport.base, out)
948
self.assertEqual('', err)
950
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)