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
branch1.bzrdir.sprout('bound')
133
bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
134
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
135
branch3.bind(branch1)
136
out, err = self.runbzr('info bound')
137
self.assertEqualDiff(
140
checkout of branch: %s
146
control: Meta directory format 1
147
working tree: Working tree format 3
148
branch: Branch format 5
159
0 versioned subdirectories
170
""" % (branch3.bzrdir.root_transport.base,
171
branch1.bzrdir.root_transport.base,
172
branch1.bzrdir.root_transport.base,
173
branch3.repository._format.get_format_description(),
174
datestring_first, datestring_first,
175
# poking at _revision_store isn't all that clean, but neither is
176
# having the ui test dependent on the exact overhead of a given store.
177
branch3.repository._revision_store.total_size(
178
branch3.repository.get_transaction())[1] / 1024,
180
self.assertEqual('', err)
182
# Checkout standalone (same as above, but does not have parent set)
183
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
184
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
185
branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
186
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
187
branch4.bind(branch1)
188
branch4.bzrdir.open_workingtree().update()
189
out, err = self.runbzr('info checkout --verbose')
190
self.assertEqualDiff(
193
checkout of branch: %s
196
control: Meta directory format 1
197
working tree: Working tree format 3
198
branch: Branch format 5
209
0 versioned subdirectories
221
""" % (branch4.bzrdir.root_transport.base,
222
branch1.bzrdir.root_transport.base,
223
branch4.repository._format.get_format_description(),
224
datestring_first, datestring_first,
225
# poking at _revision_store isn't all that clean, but neither is
226
# having the ui test dependent on the exact overhead of a given store.
227
branch4.repository._revision_store.total_size(
228
branch4.repository.get_transaction())[1] / 1024,
230
self.assertEqual('', err)
232
# Lightweight checkout (same as above, different branch and repository)
233
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
234
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
235
transport.mkdir('lightcheckout')
236
dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
237
bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
238
dir5.create_workingtree()
239
tree5 = dir5.open_workingtree()
240
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
241
branch5 = tree5.branch
242
out, err = self.runbzr('info lightcheckout')
243
self.assertEqualDiff(
245
light checkout root: %s
246
checkout of branch: %s
249
control: Meta directory format 1
250
working tree: Working tree format 3
251
branch: Branch format 4
252
repository: Weave repository format 6
262
0 versioned subdirectories
273
""" % (tree5.bzrdir.root_transport.base,
274
branch1.bzrdir.root_transport.base,
275
datestring_first, datestring_first,
277
self.assertEqual('', err)
279
# Update initial standalone branch
280
self.build_tree(['standalone/b'])
282
tree1.commit('commit two')
283
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
284
datestring_last = format_date(rev.timestamp, rev.timezone)
286
# Out of date branched standalone branch will not be detected
287
out, err = self.runbzr('info branch')
288
self.assertEqualDiff(
294
publish to branch: %s
297
control: All-in-one format 6
298
working tree: Working tree format 2
299
branch: Branch format 4
300
repository: Weave repository format 6
310
0 versioned subdirectories
321
""" % (branch2.bzrdir.root_transport.base,
322
branch1.bzrdir.root_transport.base,
323
branch1.bzrdir.root_transport.base,
324
datestring_first, datestring_first,
326
self.assertEqual('', err)
328
# Out of date bound branch
329
out, err = self.runbzr('info bound')
330
self.assertEqualDiff(
333
checkout of branch: %s
339
control: Meta directory format 1
340
working tree: Working tree format 3
341
branch: Branch format 5
344
Branch is out of date: missing 1 revision.
354
0 versioned subdirectories
365
""" % (branch3.bzrdir.root_transport.base,
366
branch1.bzrdir.root_transport.base,
367
branch1.bzrdir.root_transport.base,
368
branch3.repository._format.get_format_description(),
369
datestring_first, datestring_first,
370
# poking at _revision_store isn't all that clean, but neither is
371
# having the ui test dependent on the exact overhead of a given store.
372
branch3.repository._revision_store.total_size(
373
branch3.repository.get_transaction())[1] / 1024,
375
self.assertEqual('', err)
377
# Out of date checkout
378
out, err = self.runbzr('info checkout')
379
self.assertEqualDiff(
382
checkout of branch: %s
385
control: Meta directory format 1
386
working tree: Working tree format 3
387
branch: Branch format 5
390
Branch is out of date: missing 1 revision.
400
0 versioned subdirectories
411
""" % (branch4.bzrdir.root_transport.base,
412
branch1.bzrdir.root_transport.base,
413
branch4.repository._format.get_format_description(),
414
datestring_first, datestring_first,
415
# poking at _revision_store isn't all that clean, but neither is
416
# having the ui test dependent on the exact overhead of a given store.
417
branch4.repository._revision_store.total_size(
418
branch4.repository.get_transaction())[1] / 1024,
420
self.assertEqual('', err)
422
# Out of date lightweight checkout
423
out, err = self.runbzr('info lightcheckout --verbose')
424
self.assertEqualDiff(
426
light checkout root: %s
427
checkout of branch: %s
430
control: Meta directory format 1
431
working tree: Working tree format 3
432
branch: Branch format 4
433
repository: Weave repository format 6
435
Working tree is out of date: missing 1 revision.
445
0 versioned subdirectories
457
""" % (tree5.bzrdir.root_transport.base,
458
branch1.bzrdir.root_transport.base,
459
datestring_first, datestring_last,
461
self.assertEqual('', err)
463
def test_info_shared_repository(self):
464
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
465
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
466
transport = self.get_transport()
468
# Create shared repository
469
repo = self.make_repository('repo', shared=True)
470
repo.set_make_working_trees(False)
471
out, err = self.runbzr('info repo')
472
self.assertEqualDiff(
474
shared repository: %s
477
control: Meta directory format 1
483
""" % (repo.bzrdir.root_transport.base,
484
repo._format.get_format_description(),
486
self.assertEqual('', err)
488
# Create branch inside shared repository
489
repo.bzrdir.root_transport.mkdir('branch')
490
branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
491
out, err = self.runbzr('info repo/branch')
492
self.assertEqualDiff(
494
shared repository: %s
495
repository branch: branch
498
control: Meta directory format 1
499
branch: Branch format 5
508
""" % (repo.bzrdir.root_transport.base,
509
repo._format.get_format_description(),
511
self.assertEqual('', err)
513
# Create lightweight checkout
514
transport.mkdir('tree')
515
transport.mkdir('tree/lightcheckout')
516
dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
517
bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
518
dir2.create_workingtree()
519
tree2 = dir2.open_workingtree()
520
branch2 = tree2.branch
521
out, err = self.runbzr('info tree/lightcheckout')
522
self.assertEqualDiff(
524
light checkout root: %s
525
shared repository: %s
526
repository branch: branch
529
control: Meta directory format 1
530
working tree: Working tree format 3
531
branch: Branch format 5
542
0 versioned subdirectories
550
""" % (tree2.bzrdir.root_transport.base,
551
repo.bzrdir.root_transport.base,
552
repo._format.get_format_description(),
554
self.assertEqual('', err)
556
# Create normal checkout
557
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
558
branch3.bind(branch1)
559
tree3 = branch3.bzrdir.open_workingtree()
561
out, err = self.runbzr('info tree/checkout --verbose')
562
self.assertEqualDiff(
565
checkout of branch: %s
568
control: Meta directory format 1
569
working tree: Working tree format 3
570
branch: Branch format 5
581
0 versioned subdirectories
590
""" % (branch3.bzrdir.root_transport.base,
591
branch1.bzrdir.root_transport.base,
592
repo._format.get_format_description(),
594
self.assertEqual('', err)
596
# Update lightweight checkout
597
self.build_tree(['tree/lightcheckout/a'])
599
tree2.commit('commit one')
600
rev = repo.get_revision(branch2.revision_history()[0])
601
datestring_first = format_date(rev.timestamp, rev.timezone)
602
out, err = self.runbzr('info tree/lightcheckout --verbose')
603
self.assertEqualDiff(
605
light checkout root: %s
606
shared repository: %s
607
repository branch: branch
610
control: Meta directory format 1
611
working tree: Working tree format 3
612
branch: Branch format 5
623
0 versioned subdirectories
635
""" % (tree2.bzrdir.root_transport.base,
636
repo.bzrdir.root_transport.base,
637
repo._format.get_format_description(),
638
datestring_first, datestring_first,
639
# poking at _revision_store isn't all that clean, but neither is
640
# having the ui test dependent on the exact overhead of a given store.
641
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
643
self.assertEqual('', err)
645
# Out of date checkout
646
out, err = self.runbzr('info tree/checkout')
647
self.assertEqualDiff(
650
checkout of branch: %s
653
control: Meta directory format 1
654
working tree: Working tree format 3
655
branch: Branch format 5
658
Branch is out of date: missing 1 revision.
668
0 versioned subdirectories
676
""" % (tree3.bzrdir.root_transport.base,
677
branch1.bzrdir.root_transport.base,
678
repo._format.get_format_description(),
680
self.assertEqual('', err)
684
self.build_tree(['tree/checkout/b'])
686
out, err = self.runbzr('info tree/checkout --verbose')
687
self.assertEqualDiff(
690
checkout of branch: %s
693
control: Meta directory format 1
694
working tree: Working tree format 3
695
branch: Branch format 5
706
0 versioned subdirectories
718
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
719
repo._format.get_format_description(),
720
datestring_first, datestring_first,
721
# poking at _revision_store isn't all that clean, but neither is
722
# having the ui test dependent on the exact overhead of a given store.
723
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
725
self.assertEqual('', err)
726
tree3.commit('commit two')
728
# Out of date lightweight checkout
729
rev = repo.get_revision(branch1.revision_history()[-1])
730
datestring_last = format_date(rev.timestamp, rev.timezone)
731
out, err = self.runbzr('info tree/lightcheckout --verbose')
732
self.assertEqualDiff(
734
light checkout root: %s
735
shared repository: %s
736
repository branch: branch
739
control: Meta directory format 1
740
working tree: Working tree format 3
741
branch: Branch format 5
744
Working tree is out of date: missing 1 revision.
754
0 versioned subdirectories
766
""" % (tree2.bzrdir.root_transport.base,
767
repo.bzrdir.root_transport.base,
768
repo._format.get_format_description(),
769
datestring_first, datestring_last,
770
# poking at _revision_store isn't all that clean, but neither is
771
# having the ui test dependent on the exact overhead of a given store.
772
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
774
self.assertEqual('', err)
776
# Show info about shared branch
777
out, err = self.runbzr('info repo/branch --verbose')
778
self.assertEqualDiff(
780
shared repository: %s
781
repository branch: branch
784
control: Meta directory format 1
785
branch: Branch format 5
798
""" % (repo.bzrdir.root_transport.base,
799
repo._format.get_format_description(),
800
datestring_first, datestring_last,
801
# poking at _revision_store isn't all that clean, but neither is
802
# having the ui test dependent on the exact overhead of a given store.
803
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
805
self.assertEqual('', err)
807
# Show info about repository with revisions
808
out, err = self.runbzr('info repo')
809
self.assertEqualDiff(
811
shared repository: %s
814
control: Meta directory format 1
820
""" % (repo.bzrdir.root_transport.base,
821
repo._format.get_format_description(),
822
# poking at _revision_store isn't all that clean, but neither is
823
# having the ui test dependent on the exact overhead of a given store.
824
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
826
self.assertEqual('', err)
828
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
830
def test_info_shared_repository_with_trees(self):
831
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
832
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
833
transport = self.get_transport()
835
# Create shared repository with working trees
836
repo = self.make_repository('repo', shared=True)
837
repo.set_make_working_trees(True)
838
out, err = self.runbzr('info repo')
839
self.assertEqualDiff(
841
shared repository: %s
844
control: Meta directory format 1
847
Create working tree for new branches inside the repository.
852
""" % (repo.bzrdir.root_transport.base,
853
repo._format.get_format_description(),
855
self.assertEqual('', err)
857
# Create two branches
858
repo.bzrdir.root_transport.mkdir('branch1')
859
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
860
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
863
out, err = self.runbzr('info repo/branch1 --verbose')
864
self.assertEqualDiff(
866
shared repository: %s
867
repository checkout: branch1
870
control: Meta directory format 1
871
working tree: Working tree format 3
872
branch: Branch format 5
883
0 versioned subdirectories
892
""" % (repo.bzrdir.root_transport.base,
893
repo._format.get_format_description(),
895
self.assertEqual('', err)
897
# Update first branch
898
self.build_tree(['repo/branch1/a'])
899
tree1 = branch1.bzrdir.open_workingtree()
901
tree1.commit('commit one')
902
rev = repo.get_revision(branch1.revision_history()[0])
903
datestring_first = format_date(rev.timestamp, rev.timezone)
904
out, err = self.runbzr('info repo/branch1')
905
self.assertEqualDiff(
907
shared repository: %s
908
repository checkout: branch1
911
control: Meta directory format 1
912
working tree: Working tree format 3
913
branch: Branch format 5
924
0 versioned subdirectories
935
""" % (repo.bzrdir.root_transport.base,
936
repo._format.get_format_description(),
937
datestring_first, datestring_first,
938
# poking at _revision_store isn't all that clean, but neither is
939
# having the ui test dependent on the exact overhead of a given store.
940
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
942
self.assertEqual('', err)
944
# Out of date second branch
945
out, err = self.runbzr('info repo/branch2 --verbose')
946
self.assertEqualDiff(
948
shared repository: %s
949
repository checkout: branch2
955
control: Meta directory format 1
956
working tree: Working tree format 3
957
branch: Branch format 5
968
0 versioned subdirectories
977
""" % (repo.bzrdir.root_transport.base,
978
branch1.bzrdir.root_transport.base,
979
repo._format.get_format_description(),
980
# poking at _revision_store isn't all that clean, but neither is
981
# having the ui test dependent on the exact overhead of a given store.
982
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
984
self.assertEqual('', err)
986
# Update second branch
987
tree2 = branch2.bzrdir.open_workingtree()
989
out, err = self.runbzr('info repo/branch2')
990
self.assertEqualDiff(
992
shared repository: %s
993
repository checkout: branch2
999
control: Meta directory format 1
1000
working tree: Working tree format 3
1001
branch: Branch format 5
1004
In the working tree:
1012
0 versioned subdirectories
1023
""" % (repo.bzrdir.root_transport.base,
1024
branch1.bzrdir.root_transport.base,
1025
repo._format.get_format_description(),
1026
datestring_first, datestring_first,
1027
# poking at _revision_store isn't all that clean, but neither is
1028
# having the ui test dependent on the exact overhead of a given store.
1029
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1031
self.assertEqual('', err)
1033
# Show info about repository with revisions
1034
out, err = self.runbzr('info repo')
1035
self.assertEqualDiff(
1037
shared repository: %s
1040
control: Meta directory format 1
1043
Create working tree for new branches inside the repository.
1048
""" % (repo.bzrdir.root_transport.base,
1049
repo._format.get_format_description(),
1050
# poking at _revision_store isn't all that clean, but neither is
1051
# having the ui test dependent on the exact overhead of a given store.
1052
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1055
self.assertEqual('', err)
1057
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1059
def test_info_shared_repository_with_tree_in_root(self):
1060
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
1061
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
1062
transport = self.get_transport()
1064
# Create shared repository with working trees
1065
repo = self.make_repository('repo', shared=True)
1066
repo.set_make_working_trees(True)
1067
out, err = self.runbzr('info repo')
1068
self.assertEqualDiff(
1070
shared repository: %s
1073
control: Meta directory format 1
1076
Create working tree for new branches inside the repository.
1081
""" % (repo.bzrdir.root_transport.base,
1082
repo._format.get_format_description(),
1084
self.assertEqual('', err)
1086
# Create branch in root of repository
1087
control = repo.bzrdir
1088
branch = control.create_branch()
1089
control.create_workingtree()
1090
out, err = self.runbzr('info repo')
1091
self.assertEqualDiff(
1093
shared repository: %s
1094
repository checkout: .
1097
control: Meta directory format 1
1098
working tree: Working tree format 3
1099
branch: Branch format 5
1102
In the working tree:
1110
0 versioned subdirectories
1118
""" % (repo.bzrdir.root_transport.base,
1119
repo._format.get_format_description(),
1121
self.assertEqual('', err)
1123
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1125
def test_info_locking(self):
1126
transport = self.get_transport()
1127
# Create shared repository with a branch
1128
repo = self.make_repository('repo', shared=True,
1129
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1130
repo.set_make_working_trees(False)
1131
repo.bzrdir.root_transport.mkdir('branch')
1132
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1133
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1134
# Do a heavy checkout
1135
transport.mkdir('tree')
1136
transport.mkdir('tree/checkout')
1137
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1138
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1139
co_branch.bind(repo_branch)
1140
# Do a light checkout of the heavy one
1141
transport.mkdir('tree/lightcheckout')
1142
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1143
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1144
lco_dir.create_workingtree()
1145
lco_tree = lco_dir.open_workingtree()
1147
# Test all permutations of locking the working tree, branch and repository
1151
out, err = self.runbzr('info tree/lightcheckout')
1152
self.assertEqualDiff(
1154
light checkout root: %s
1155
checkout of branch: %s
1158
control: Meta directory format 1
1159
working tree: Working tree format 3
1160
branch: Branch format 5
1163
In the working tree:
1171
0 versioned subdirectories
1179
""" % (lco_tree.bzrdir.root_transport.base,
1180
lco_tree.branch.bzrdir.root_transport.base,
1181
lco_tree.branch.repository._format.get_format_description(),
1183
self.assertEqual('', err)
1185
lco_tree.branch.repository.lock_write()
1186
out, err = self.runbzr('info tree/lightcheckout')
1187
self.assertEqualDiff(
1189
light checkout root: %s
1190
checkout of branch: %s
1193
control: Meta directory format 1
1194
working tree: Working tree format 3
1195
branch: Branch format 5
1199
working tree: unlocked
1203
In the working tree:
1211
0 versioned subdirectories
1219
""" % (lco_tree.bzrdir.root_transport.base,
1220
lco_tree.branch.bzrdir.root_transport.base,
1221
lco_tree.branch.repository._format.get_format_description(),
1223
self.assertEqual('', err)
1224
lco_tree.branch.repository.unlock()
1226
lco_tree.branch.lock_write()
1227
out, err = self.runbzr('info tree/lightcheckout')
1228
self.assertEqualDiff(
1230
light checkout root: %s
1231
checkout of branch: %s
1234
control: Meta directory format 1
1235
working tree: Working tree format 3
1236
branch: Branch format 5
1240
working tree: unlocked
1244
In the working tree:
1252
0 versioned subdirectories
1260
""" % (lco_tree.bzrdir.root_transport.base,
1261
lco_tree.branch.bzrdir.root_transport.base,
1262
lco_tree.branch.repository._format.get_format_description(),
1264
self.assertEqual('', err)
1265
lco_tree.branch.unlock()
1267
lco_tree.lock_write()
1268
out, err = self.runbzr('info tree/lightcheckout')
1269
self.assertEqualDiff(
1271
light checkout root: %s
1272
checkout of branch: %s
1275
control: Meta directory format 1
1276
working tree: Working tree format 3
1277
branch: Branch format 5
1281
working tree: locked
1285
In the working tree:
1293
0 versioned subdirectories
1301
""" % (lco_tree.bzrdir.root_transport.base,
1302
lco_tree.branch.bzrdir.root_transport.base,
1303
lco_tree.branch.repository._format.get_format_description(),
1305
self.assertEqual('', err)
1308
lco_tree.lock_write()
1309
lco_tree.branch.repository.unlock()
1310
out, err = self.runbzr('info tree/lightcheckout')
1311
self.assertEqualDiff(
1313
light checkout root: %s
1314
checkout of branch: %s
1317
control: Meta directory format 1
1318
working tree: Working tree format 3
1319
branch: Branch format 5
1323
working tree: locked
1325
repository: unlocked
1327
In the working tree:
1335
0 versioned subdirectories
1343
""" % (lco_tree.bzrdir.root_transport.base,
1344
lco_tree.branch.bzrdir.root_transport.base,
1345
lco_tree.branch.repository._format.get_format_description(),
1347
self.assertEqual('', err)
1348
lco_tree.branch.repository.lock_write()
1351
lco_tree.lock_write()
1352
lco_tree.branch.unlock()
1353
out, err = self.runbzr('info tree/lightcheckout')
1354
self.assertEqualDiff(
1356
light checkout root: %s
1357
checkout of branch: %s
1360
control: Meta directory format 1
1361
working tree: Working tree format 3
1362
branch: Branch format 5
1366
working tree: locked
1368
repository: unlocked
1370
In the working tree:
1378
0 versioned subdirectories
1386
""" % (lco_tree.bzrdir.root_transport.base,
1387
lco_tree.branch.bzrdir.root_transport.base,
1388
lco_tree.branch.repository._format.get_format_description(),
1390
self.assertEqual('', err)
1391
lco_tree.branch.lock_write()
1394
lco_tree.lock_write()
1395
lco_tree.branch.unlock()
1396
lco_tree.branch.repository.lock_write()
1397
out, err = self.runbzr('info tree/lightcheckout')
1398
self.assertEqualDiff(
1400
light checkout root: %s
1401
checkout of branch: %s
1404
control: Meta directory format 1
1405
working tree: Working tree format 3
1406
branch: Branch format 5
1410
working tree: locked
1414
In the working tree:
1422
0 versioned subdirectories
1430
""" % (lco_tree.bzrdir.root_transport.base,
1431
lco_tree.branch.bzrdir.root_transport.base,
1432
lco_tree.branch.repository._format.get_format_description(),
1434
self.assertEqual('', err)
1435
lco_tree.branch.repository.unlock()
1436
lco_tree.branch.lock_write()
1439
lco_tree.branch.lock_write()
1440
lco_tree.branch.repository.unlock()
1441
out, err = self.runbzr('info tree/lightcheckout')
1442
self.assertEqualDiff(
1444
light checkout root: %s
1445
checkout of branch: %s
1448
control: Meta directory format 1
1449
working tree: Working tree format 3
1450
branch: Branch format 5
1454
working tree: unlocked
1456
repository: unlocked
1458
In the working tree:
1466
0 versioned subdirectories
1474
""" % (lco_tree.bzrdir.root_transport.base,
1475
lco_tree.branch.bzrdir.root_transport.base,
1476
lco_tree.branch.repository._format.get_format_description(),
1478
self.assertEqual('', err)
1479
lco_tree.branch.repository.lock_write()
1480
lco_tree.branch.unlock()
1482
def test_info_locking_oslocks(self):
1483
tree = self.make_branch_and_tree('branch',
1484
format=bzrlib.bzrdir.BzrDirFormat6())
1486
# Test all permutations of locking the working tree, branch and repository
1487
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1488
# implemented by raising NotImplementedError and get_physical_lock_status()
1489
# always returns false. This makes bzr info hide the lock status. (Olaf)
1493
out, err = self.runbzr('info branch')
1494
self.assertEqualDiff(
1499
control: All-in-one format 6
1500
working tree: Working tree format 2
1501
branch: Branch format 4
1504
In the working tree:
1512
0 versioned subdirectories
1520
""" % (tree.bzrdir.root_transport.base,
1521
tree.branch.repository._format.get_format_description(),
1523
self.assertEqual('', err)
1526
out, err = self.runbzr('info branch')
1527
self.assertEqualDiff(
1532
control: All-in-one format 6
1533
working tree: Working tree format 2
1534
branch: Branch format 4
1537
In the working tree:
1545
0 versioned subdirectories
1553
""" % (tree.bzrdir.root_transport.base,
1554
tree.branch.repository._format.get_format_description(),
1556
self.assertEqual('', err)