1
# Copyright (C) 2006 by Canonical Ltd
2
# -*- coding: utf-8 -*-
4
# This program is free software; you can redistribute it and/or modify
5
# it under the terms of the GNU General Public License as published by
6
# the Free Software Foundation; either version 2 of the License, or
7
# (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
"""Tests for the info command of bzr."""
25
from bzrlib.osutils import format_date
26
from bzrlib.tests import TestSkipped
27
from bzrlib.tests.blackbox import ExternalBase
30
class TestInfo(ExternalBase):
32
def test_info_non_existing(self):
33
out, err = self.runbzr('info /i/do/not/exist/', retcode=3)
34
self.assertEqual(out, '')
35
self.assertEqual(err, 'bzr: ERROR: Not a branch: /i/do/not/exist/\n')
37
def test_info_standalone(self):
38
transport = self.get_transport()
40
# Create initial standalone branch
41
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
42
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirFormat6())
43
tree1 = self.make_branch_and_tree('standalone')
44
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
45
self.build_tree(['standalone/a'])
47
branch1 = tree1.branch
48
out, err = self.runbzr('info standalone')
54
control: All-in-one format 6
55
working tree: Working tree format 2
56
branch: Branch format 4
57
repository: Weave repository format 6
67
0 versioned subdirectories
75
""" % branch1.bzrdir.root_transport.base, out)
76
self.assertEqual('', err)
77
tree1.commit('commit one')
78
rev = branch1.repository.get_revision(branch1.revision_history()[0])
79
datestring_first = format_date(rev.timestamp, rev.timezone)
81
# Branch standalone with push location
82
branch2 = branch1.bzrdir.sprout('branch').open_branch()
83
branch2.set_push_location(branch1.bzrdir.root_transport.base)
84
out, err = self.runbzr('info branch --verbose')
94
control: All-in-one format 6
95
working tree: Working tree format 2
96
branch: Branch format 4
97
repository: Weave repository format 6
107
0 versioned subdirectories
119
""" % (branch2.bzrdir.root_transport.base,
120
branch1.bzrdir.root_transport.base,
121
branch1.bzrdir.root_transport.base,
122
datestring_first, datestring_first,
123
# poking at _revision_store isn't all that clean, but neither is
124
# having the ui test dependent on the exact overhead of a given store.
125
branch2.repository._revision_store.total_size(
126
branch2.repository.get_transaction())[1] / 1024,
128
self.assertEqual('', err)
130
# Branch and bind to standalone, needs upgrade to metadir
131
# (creates backup as unknown)
132
# XXX: I can't get this to work through API
133
self.runbzr('branch standalone bound')
134
#branch3 = branch1.bzrdir.sprout('bound').open_branch()
135
self.runbzr('upgrade --format=metaweave bound')
136
#bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
137
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
138
branch3.bind(branch1)
139
out, err = self.runbzr('info bound')
140
self.assertEqualDiff(
143
checkout of branch: %s
149
control: Meta directory format 1
150
working tree: Working tree format 3
151
branch: Branch format 5
162
0 versioned subdirectories
173
""" % (branch3.bzrdir.root_transport.base,
174
branch1.bzrdir.root_transport.base,
175
branch1.bzrdir.root_transport.base,
176
branch3.repository._format.get_format_description(),
177
datestring_first, datestring_first,
178
# poking at _revision_store isn't all that clean, but neither is
179
# having the ui test dependent on the exact overhead of a given store.
180
branch3.repository._revision_store.total_size(
181
branch3.repository.get_transaction())[1] / 1024,
183
self.assertEqual('', err)
185
# Checkout standalone (same as above, but does not have parent set)
186
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
187
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
188
branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
189
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
190
branch4.bind(branch1)
191
branch4.bzrdir.open_workingtree().update()
192
out, err = self.runbzr('info checkout --verbose')
193
self.assertEqualDiff(
196
checkout of branch: %s
199
control: Meta directory format 1
200
working tree: Working tree format 3
201
branch: Branch format 5
212
0 versioned subdirectories
224
""" % (branch4.bzrdir.root_transport.base,
225
branch1.bzrdir.root_transport.base,
226
branch4.repository._format.get_format_description(),
227
datestring_first, datestring_first,
228
# poking at _revision_store isn't all that clean, but neither is
229
# having the ui test dependent on the exact overhead of a given store.
230
branch4.repository._revision_store.total_size(
231
branch4.repository.get_transaction())[1] / 1024,
233
self.assertEqual('', err)
235
# Lightweight checkout (same as above, different branch and repository)
236
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
237
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
238
transport.mkdir('lightcheckout')
239
dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
240
bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
241
dir5.create_workingtree()
242
tree5 = dir5.open_workingtree()
243
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
244
branch5 = tree5.branch
245
out, err = self.runbzr('info lightcheckout')
246
self.assertEqualDiff(
248
light checkout root: %s
249
checkout of branch: %s
252
control: Meta directory format 1
253
working tree: Working tree format 3
254
branch: Branch format 4
255
repository: Weave repository format 6
265
0 versioned subdirectories
276
""" % (tree5.bzrdir.root_transport.base,
277
branch1.bzrdir.root_transport.base,
278
datestring_first, datestring_first,
280
self.assertEqual('', err)
282
# Update initial standalone branch
283
self.build_tree(['standalone/b'])
285
tree1.commit('commit two')
286
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
287
datestring_last = format_date(rev.timestamp, rev.timezone)
289
# Out of date branched standalone branch will not be detected
290
out, err = self.runbzr('info branch')
291
self.assertEqualDiff(
297
publish to branch: %s
300
control: All-in-one format 6
301
working tree: Working tree format 2
302
branch: Branch format 4
303
repository: Weave repository format 6
313
0 versioned subdirectories
324
""" % (branch2.bzrdir.root_transport.base,
325
branch1.bzrdir.root_transport.base,
326
branch1.bzrdir.root_transport.base,
327
datestring_first, datestring_first,
329
self.assertEqual('', err)
331
# Out of date bound branch
332
out, err = self.runbzr('info bound')
333
self.assertEqualDiff(
336
checkout of branch: %s
342
control: Meta directory format 1
343
working tree: Working tree format 3
344
branch: Branch format 5
347
Branch is out of date: missing 1 revision.
357
0 versioned subdirectories
368
""" % (branch3.bzrdir.root_transport.base,
369
branch1.bzrdir.root_transport.base,
370
branch1.bzrdir.root_transport.base,
371
branch3.repository._format.get_format_description(),
372
datestring_first, datestring_first,
373
# poking at _revision_store isn't all that clean, but neither is
374
# having the ui test dependent on the exact overhead of a given store.
375
branch3.repository._revision_store.total_size(
376
branch3.repository.get_transaction())[1] / 1024,
378
self.assertEqual('', err)
380
# Out of date checkout
381
out, err = self.runbzr('info checkout')
382
self.assertEqualDiff(
385
checkout of branch: %s
388
control: Meta directory format 1
389
working tree: Working tree format 3
390
branch: Branch format 5
393
Branch is out of date: missing 1 revision.
403
0 versioned subdirectories
414
""" % (branch4.bzrdir.root_transport.base,
415
branch1.bzrdir.root_transport.base,
416
branch4.repository._format.get_format_description(),
417
datestring_first, datestring_first,
418
# poking at _revision_store isn't all that clean, but neither is
419
# having the ui test dependent on the exact overhead of a given store.
420
branch4.repository._revision_store.total_size(
421
branch4.repository.get_transaction())[1] / 1024,
423
self.assertEqual('', err)
425
# Out of date lightweight checkout
426
out, err = self.runbzr('info lightcheckout --verbose')
427
self.assertEqualDiff(
429
light checkout root: %s
430
checkout of branch: %s
433
control: Meta directory format 1
434
working tree: Working tree format 3
435
branch: Branch format 4
436
repository: Weave repository format 6
438
Working tree is out of date: missing 1 revision.
448
0 versioned subdirectories
460
""" % (tree5.bzrdir.root_transport.base,
461
branch1.bzrdir.root_transport.base,
462
datestring_first, datestring_last,
464
self.assertEqual('', err)
466
def test_info_shared_repository(self):
467
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
468
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
469
transport = self.get_transport()
471
# Create shared repository
472
repo = self.make_repository('repo', shared=True)
473
repo.set_make_working_trees(False)
474
out, err = self.runbzr('info repo')
475
self.assertEqualDiff(
477
shared repository: %s
480
control: Meta directory format 1
486
""" % (repo.bzrdir.root_transport.base,
487
repo._format.get_format_description(),
489
self.assertEqual('', err)
491
# Create branch inside shared repository
492
repo.bzrdir.root_transport.mkdir('branch')
493
branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
494
out, err = self.runbzr('info repo/branch')
495
self.assertEqualDiff(
497
shared repository: %s
498
repository branch: branch
501
control: Meta directory format 1
502
branch: Branch format 5
511
""" % (repo.bzrdir.root_transport.base,
512
repo._format.get_format_description(),
514
self.assertEqual('', err)
516
# Create lightweight checkout
517
transport.mkdir('tree')
518
transport.mkdir('tree/lightcheckout')
519
dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
520
bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
521
dir2.create_workingtree()
522
tree2 = dir2.open_workingtree()
523
branch2 = tree2.branch
524
out, err = self.runbzr('info tree/lightcheckout')
525
self.assertEqualDiff(
527
light checkout root: %s
528
shared repository: %s
529
repository branch: branch
532
control: Meta directory format 1
533
working tree: Working tree format 3
534
branch: Branch format 5
545
0 versioned subdirectories
553
""" % (tree2.bzrdir.root_transport.base,
554
repo.bzrdir.root_transport.base,
555
repo._format.get_format_description(),
557
self.assertEqual('', err)
559
# Create normal checkout
560
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
561
branch3.bind(branch1)
562
tree3 = branch3.bzrdir.open_workingtree()
564
out, err = self.runbzr('info tree/checkout --verbose')
565
self.assertEqualDiff(
568
checkout of branch: %s
571
control: Meta directory format 1
572
working tree: Working tree format 3
573
branch: Branch format 5
584
0 versioned subdirectories
593
""" % (branch3.bzrdir.root_transport.base,
594
branch1.bzrdir.root_transport.base,
595
repo._format.get_format_description(),
597
self.assertEqual('', err)
599
# Update lightweight checkout
600
self.build_tree(['tree/lightcheckout/a'])
602
tree2.commit('commit one')
603
rev = repo.get_revision(branch2.revision_history()[0])
604
datestring_first = format_date(rev.timestamp, rev.timezone)
605
out, err = self.runbzr('info tree/lightcheckout --verbose')
606
self.assertEqualDiff(
608
light checkout root: %s
609
shared repository: %s
610
repository branch: branch
613
control: Meta directory format 1
614
working tree: Working tree format 3
615
branch: Branch format 5
626
0 versioned subdirectories
638
""" % (tree2.bzrdir.root_transport.base,
639
repo.bzrdir.root_transport.base,
640
repo._format.get_format_description(),
641
datestring_first, datestring_first,
642
# poking at _revision_store isn't all that clean, but neither is
643
# having the ui test dependent on the exact overhead of a given store.
644
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
646
self.assertEqual('', err)
648
# Out of date checkout
649
out, err = self.runbzr('info tree/checkout')
650
self.assertEqualDiff(
653
checkout of branch: %s
656
control: Meta directory format 1
657
working tree: Working tree format 3
658
branch: Branch format 5
661
Branch is out of date: missing 1 revision.
671
0 versioned subdirectories
679
""" % (tree3.bzrdir.root_transport.base,
680
branch1.bzrdir.root_transport.base,
681
repo._format.get_format_description(),
683
self.assertEqual('', err)
687
self.build_tree(['tree/checkout/b'])
689
out, err = self.runbzr('info tree/checkout --verbose')
690
self.assertEqualDiff(
693
checkout of branch: %s
696
control: Meta directory format 1
697
working tree: Working tree format 3
698
branch: Branch format 5
709
0 versioned subdirectories
721
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
722
repo._format.get_format_description(),
723
datestring_first, datestring_first,
724
# poking at _revision_store isn't all that clean, but neither is
725
# having the ui test dependent on the exact overhead of a given store.
726
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
728
self.assertEqual('', err)
729
tree3.commit('commit two')
731
# Out of date lightweight checkout
732
rev = repo.get_revision(branch1.revision_history()[-1])
733
datestring_last = format_date(rev.timestamp, rev.timezone)
734
out, err = self.runbzr('info tree/lightcheckout --verbose')
735
self.assertEqualDiff(
737
light checkout root: %s
738
shared repository: %s
739
repository branch: branch
742
control: Meta directory format 1
743
working tree: Working tree format 3
744
branch: Branch format 5
747
Working tree is out of date: missing 1 revision.
757
0 versioned subdirectories
769
""" % (tree2.bzrdir.root_transport.base,
770
repo.bzrdir.root_transport.base,
771
repo._format.get_format_description(),
772
datestring_first, datestring_last,
773
# poking at _revision_store isn't all that clean, but neither is
774
# having the ui test dependent on the exact overhead of a given store.
775
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
777
self.assertEqual('', err)
779
# Show info about shared branch
780
out, err = self.runbzr('info repo/branch --verbose')
781
self.assertEqualDiff(
783
shared repository: %s
784
repository branch: branch
787
control: Meta directory format 1
788
branch: Branch format 5
801
""" % (repo.bzrdir.root_transport.base,
802
repo._format.get_format_description(),
803
datestring_first, datestring_last,
804
# poking at _revision_store isn't all that clean, but neither is
805
# having the ui test dependent on the exact overhead of a given store.
806
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
808
self.assertEqual('', err)
810
# Show info about repository with revisions
811
out, err = self.runbzr('info repo')
812
self.assertEqualDiff(
814
shared repository: %s
817
control: Meta directory format 1
823
""" % (repo.bzrdir.root_transport.base,
824
repo._format.get_format_description(),
825
# poking at _revision_store isn't all that clean, but neither is
826
# having the ui test dependent on the exact overhead of a given store.
827
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
829
self.assertEqual('', err)
831
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
833
def test_info_shared_repository_with_trees(self):
834
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
835
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
836
transport = self.get_transport()
838
# Create shared repository with working trees
839
repo = self.make_repository('repo', shared=True)
840
repo.set_make_working_trees(True)
841
out, err = self.runbzr('info repo')
842
self.assertEqualDiff(
844
shared repository: %s
847
control: Meta directory format 1
850
Create working tree for new branches inside the repository.
855
""" % (repo.bzrdir.root_transport.base,
856
repo._format.get_format_description(),
858
self.assertEqual('', err)
860
# Create two branches
861
repo.bzrdir.root_transport.mkdir('branch1')
862
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
863
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
866
out, err = self.runbzr('info repo/branch1 --verbose')
867
self.assertEqualDiff(
869
shared repository: %s
870
repository checkout: branch1
873
control: Meta directory format 1
874
working tree: Working tree format 3
875
branch: Branch format 5
886
0 versioned subdirectories
895
""" % (repo.bzrdir.root_transport.base,
896
repo._format.get_format_description(),
898
self.assertEqual('', err)
900
# Update first branch
901
self.build_tree(['repo/branch1/a'])
902
tree1 = branch1.bzrdir.open_workingtree()
904
tree1.commit('commit one')
905
rev = repo.get_revision(branch1.revision_history()[0])
906
datestring_first = format_date(rev.timestamp, rev.timezone)
907
out, err = self.runbzr('info repo/branch1')
908
self.assertEqualDiff(
910
shared repository: %s
911
repository checkout: branch1
914
control: Meta directory format 1
915
working tree: Working tree format 3
916
branch: Branch format 5
927
0 versioned subdirectories
938
""" % (repo.bzrdir.root_transport.base,
939
repo._format.get_format_description(),
940
datestring_first, datestring_first,
941
# poking at _revision_store isn't all that clean, but neither is
942
# having the ui test dependent on the exact overhead of a given store.
943
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
945
self.assertEqual('', err)
947
# Out of date second branch
948
out, err = self.runbzr('info repo/branch2 --verbose')
949
self.assertEqualDiff(
951
shared repository: %s
952
repository checkout: branch2
958
control: Meta directory format 1
959
working tree: Working tree format 3
960
branch: Branch format 5
971
0 versioned subdirectories
980
""" % (repo.bzrdir.root_transport.base,
981
branch1.bzrdir.root_transport.base,
982
repo._format.get_format_description(),
983
# poking at _revision_store isn't all that clean, but neither is
984
# having the ui test dependent on the exact overhead of a given store.
985
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
987
self.assertEqual('', err)
989
# Update second branch
990
tree2 = branch2.bzrdir.open_workingtree()
992
out, err = self.runbzr('info repo/branch2')
993
self.assertEqualDiff(
995
shared repository: %s
996
repository checkout: branch2
1002
control: Meta directory format 1
1003
working tree: Working tree format 3
1004
branch: Branch format 5
1007
In the working tree:
1015
0 versioned subdirectories
1026
""" % (repo.bzrdir.root_transport.base,
1027
branch1.bzrdir.root_transport.base,
1028
repo._format.get_format_description(),
1029
datestring_first, datestring_first,
1030
# poking at _revision_store isn't all that clean, but neither is
1031
# having the ui test dependent on the exact overhead of a given store.
1032
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1034
self.assertEqual('', err)
1036
# Show info about repository with revisions
1037
out, err = self.runbzr('info repo')
1038
self.assertEqualDiff(
1040
shared repository: %s
1043
control: Meta directory format 1
1046
Create working tree for new branches inside the repository.
1051
""" % (repo.bzrdir.root_transport.base,
1052
repo._format.get_format_description(),
1053
# poking at _revision_store isn't all that clean, but neither is
1054
# having the ui test dependent on the exact overhead of a given store.
1055
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1058
self.assertEqual('', err)
1060
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1062
def test_info_shared_repository_with_tree_in_root(self):
1063
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
1064
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
1065
transport = self.get_transport()
1067
# Create shared repository with working trees
1068
repo = self.make_repository('repo', shared=True)
1069
repo.set_make_working_trees(True)
1070
out, err = self.runbzr('info repo')
1071
self.assertEqualDiff(
1073
shared repository: %s
1076
control: Meta directory format 1
1079
Create working tree for new branches inside the repository.
1084
""" % (repo.bzrdir.root_transport.base,
1085
repo._format.get_format_description(),
1087
self.assertEqual('', err)
1089
# Create branch in root of repository
1090
control = repo.bzrdir
1091
branch = control.create_branch()
1092
control.create_workingtree()
1093
out, err = self.runbzr('info repo')
1094
self.assertEqualDiff(
1096
shared repository: %s
1097
repository checkout: .
1100
control: Meta directory format 1
1101
working tree: Working tree format 3
1102
branch: Branch format 5
1105
In the working tree:
1113
0 versioned subdirectories
1121
""" % (repo.bzrdir.root_transport.base,
1122
repo._format.get_format_description(),
1124
self.assertEqual('', err)
1126
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1128
def test_info_locking(self):
1129
transport = self.get_transport()
1130
# Create shared repository with a branch
1131
repo = self.make_repository('repo', shared=True,
1132
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1133
repo.set_make_working_trees(False)
1134
repo.bzrdir.root_transport.mkdir('branch')
1135
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1136
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1137
# Do a heavy checkout
1138
transport.mkdir('tree')
1139
transport.mkdir('tree/checkout')
1140
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1141
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1142
co_branch.bind(repo_branch)
1143
# Do a light checkout of the heavy one
1144
transport.mkdir('tree/lightcheckout')
1145
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1146
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1147
lco_dir.create_workingtree()
1148
lco_tree = lco_dir.open_workingtree()
1150
# Test all permutations of locking the working tree, branch and repository
1154
out, err = self.runbzr('info tree/lightcheckout')
1155
self.assertEqualDiff(
1157
light checkout root: %s
1158
checkout of branch: %s
1161
control: Meta directory format 1
1162
working tree: Working tree format 3
1163
branch: Branch format 5
1166
In the working tree:
1174
0 versioned subdirectories
1182
""" % (lco_tree.bzrdir.root_transport.base,
1183
lco_tree.branch.bzrdir.root_transport.base,
1184
lco_tree.branch.repository._format.get_format_description(),
1186
self.assertEqual('', err)
1188
lco_tree.branch.repository.lock_write()
1189
out, err = self.runbzr('info tree/lightcheckout')
1190
self.assertEqualDiff(
1192
light checkout root: %s
1193
checkout of branch: %s
1196
control: Meta directory format 1
1197
working tree: Working tree format 3
1198
branch: Branch format 5
1202
working tree: unlocked
1206
In the working tree:
1214
0 versioned subdirectories
1222
""" % (lco_tree.bzrdir.root_transport.base,
1223
lco_tree.branch.bzrdir.root_transport.base,
1224
lco_tree.branch.repository._format.get_format_description(),
1226
self.assertEqual('', err)
1227
lco_tree.branch.repository.unlock()
1229
lco_tree.branch.lock_write()
1230
out, err = self.runbzr('info tree/lightcheckout')
1231
self.assertEqualDiff(
1233
light checkout root: %s
1234
checkout of branch: %s
1237
control: Meta directory format 1
1238
working tree: Working tree format 3
1239
branch: Branch format 5
1243
working tree: unlocked
1247
In the working tree:
1255
0 versioned subdirectories
1263
""" % (lco_tree.bzrdir.root_transport.base,
1264
lco_tree.branch.bzrdir.root_transport.base,
1265
lco_tree.branch.repository._format.get_format_description(),
1267
self.assertEqual('', err)
1268
lco_tree.branch.unlock()
1270
lco_tree.lock_write()
1271
out, err = self.runbzr('info tree/lightcheckout')
1272
self.assertEqualDiff(
1274
light checkout root: %s
1275
checkout of branch: %s
1278
control: Meta directory format 1
1279
working tree: Working tree format 3
1280
branch: Branch format 5
1284
working tree: locked
1288
In the working tree:
1296
0 versioned subdirectories
1304
""" % (lco_tree.bzrdir.root_transport.base,
1305
lco_tree.branch.bzrdir.root_transport.base,
1306
lco_tree.branch.repository._format.get_format_description(),
1308
self.assertEqual('', err)
1311
lco_tree.lock_write()
1312
lco_tree.branch.repository.unlock()
1313
out, err = self.runbzr('info tree/lightcheckout')
1314
self.assertEqualDiff(
1316
light checkout root: %s
1317
checkout of branch: %s
1320
control: Meta directory format 1
1321
working tree: Working tree format 3
1322
branch: Branch format 5
1326
working tree: locked
1328
repository: unlocked
1330
In the working tree:
1338
0 versioned subdirectories
1346
""" % (lco_tree.bzrdir.root_transport.base,
1347
lco_tree.branch.bzrdir.root_transport.base,
1348
lco_tree.branch.repository._format.get_format_description(),
1350
self.assertEqual('', err)
1351
lco_tree.branch.repository.lock_write()
1354
lco_tree.lock_write()
1355
lco_tree.branch.unlock()
1356
out, err = self.runbzr('info tree/lightcheckout')
1357
self.assertEqualDiff(
1359
light checkout root: %s
1360
checkout of branch: %s
1363
control: Meta directory format 1
1364
working tree: Working tree format 3
1365
branch: Branch format 5
1369
working tree: locked
1371
repository: unlocked
1373
In the working tree:
1381
0 versioned subdirectories
1389
""" % (lco_tree.bzrdir.root_transport.base,
1390
lco_tree.branch.bzrdir.root_transport.base,
1391
lco_tree.branch.repository._format.get_format_description(),
1393
self.assertEqual('', err)
1394
lco_tree.branch.lock_write()
1397
lco_tree.lock_write()
1398
lco_tree.branch.unlock()
1399
lco_tree.branch.repository.lock_write()
1400
out, err = self.runbzr('info tree/lightcheckout')
1401
self.assertEqualDiff(
1403
light checkout root: %s
1404
checkout of branch: %s
1407
control: Meta directory format 1
1408
working tree: Working tree format 3
1409
branch: Branch format 5
1413
working tree: locked
1417
In the working tree:
1425
0 versioned subdirectories
1433
""" % (lco_tree.bzrdir.root_transport.base,
1434
lco_tree.branch.bzrdir.root_transport.base,
1435
lco_tree.branch.repository._format.get_format_description(),
1437
self.assertEqual('', err)
1438
lco_tree.branch.repository.unlock()
1439
lco_tree.branch.lock_write()
1442
lco_tree.branch.lock_write()
1443
lco_tree.branch.repository.unlock()
1444
out, err = self.runbzr('info tree/lightcheckout')
1445
self.assertEqualDiff(
1447
light checkout root: %s
1448
checkout of branch: %s
1451
control: Meta directory format 1
1452
working tree: Working tree format 3
1453
branch: Branch format 5
1457
working tree: unlocked
1459
repository: unlocked
1461
In the working tree:
1469
0 versioned subdirectories
1477
""" % (lco_tree.bzrdir.root_transport.base,
1478
lco_tree.branch.bzrdir.root_transport.base,
1479
lco_tree.branch.repository._format.get_format_description(),
1481
self.assertEqual('', err)
1482
lco_tree.branch.repository.lock_write()
1483
lco_tree.branch.unlock()
1485
def test_info_locking_oslocks(self):
1486
tree = self.make_branch_and_tree('branch',
1487
format=bzrlib.bzrdir.BzrDirFormat6())
1489
# Test all permutations of locking the working tree, branch and repository
1490
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1491
# implemented by raising NotImplementedError and get_physical_lock_status()
1492
# always returns false. This makes bzr info hide the lock status. (Olaf)
1496
out, err = self.runbzr('info branch')
1497
self.assertEqualDiff(
1502
control: All-in-one format 6
1503
working tree: Working tree format 2
1504
branch: Branch format 4
1507
In the working tree:
1515
0 versioned subdirectories
1523
""" % (tree.bzrdir.root_transport.base,
1524
tree.branch.repository._format.get_format_description(),
1526
self.assertEqual('', err)
1529
out, err = self.runbzr('info branch')
1530
self.assertEqualDiff(
1535
control: All-in-one format 6
1536
working tree: Working tree format 2
1537
branch: Branch format 4
1540
In the working tree:
1548
0 versioned subdirectories
1556
""" % (tree.bzrdir.root_transport.base,
1557
tree.branch.repository._format.get_format_description(),
1559
self.assertEqual('', err)