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."""
24
from bzrlib.osutils import format_date
25
from bzrlib.tests import TestSkipped
26
from bzrlib.tests.blackbox import ExternalBase
29
class TestInfo(ExternalBase):
31
def test_info_non_existing(self):
32
if sys.platform == "win32":
33
location = "C:/i/do/not/exist/"
35
location = "/i/do/not/exist/"
36
out, err = self.runbzr('info '+location, retcode=3)
37
self.assertEqual(out, '')
38
self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
40
def test_info_standalone(self):
41
transport = self.get_transport()
43
# Create initial standalone branch
44
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
45
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirFormat6())
46
tree1 = self.make_branch_and_tree('standalone')
47
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
48
self.build_tree(['standalone/a'])
50
branch1 = tree1.branch
51
out, err = self.runbzr('info standalone')
57
control: All-in-one format 6
58
working tree: Working tree format 2
59
branch: Branch format 4
60
repository: Weave repository format 6
70
0 versioned subdirectories
78
""" % branch1.bzrdir.root_transport.base, out)
79
self.assertEqual('', err)
80
tree1.commit('commit one')
81
rev = branch1.repository.get_revision(branch1.revision_history()[0])
82
datestring_first = format_date(rev.timestamp, rev.timezone)
84
# Branch standalone with push location
85
branch2 = branch1.bzrdir.sprout('branch').open_branch()
86
branch2.set_push_location(branch1.bzrdir.root_transport.base)
87
out, err = self.runbzr('info branch --verbose')
97
control: All-in-one format 6
98
working tree: Working tree format 2
99
branch: Branch format 4
100
repository: Weave repository format 6
110
0 versioned subdirectories
122
""" % (branch2.bzrdir.root_transport.base,
123
branch1.bzrdir.root_transport.base,
124
branch1.bzrdir.root_transport.base,
125
datestring_first, datestring_first,
126
# poking at _revision_store isn't all that clean, but neither is
127
# having the ui test dependent on the exact overhead of a given store.
128
branch2.repository._revision_store.total_size(
129
branch2.repository.get_transaction())[1] / 1024,
131
self.assertEqual('', err)
133
# Branch and bind to standalone, needs upgrade to metadir
134
# (creates backup as unknown)
135
branch1.bzrdir.sprout('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_standalone_no_tree(self):
467
# create standalone branch without a working tree
468
branch = self.make_branch('branch')
469
repo = branch.repository
470
out, err = self.runbzr('info branch')
471
self.assertEqualDiff(
476
control: Meta directory format 1
477
branch: Branch format 5
486
""" % (branch.bzrdir.root_transport.base,
487
repo._format.get_format_description(),
489
self.assertEqual('', err)
491
def test_info_shared_repository(self):
492
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
493
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
494
transport = self.get_transport()
496
# Create shared repository
497
repo = self.make_repository('repo', shared=True)
498
repo.set_make_working_trees(False)
499
out, err = self.runbzr('info repo')
500
self.assertEqualDiff(
502
shared repository: %s
505
control: Meta directory format 1
511
""" % (repo.bzrdir.root_transport.base,
512
repo._format.get_format_description(),
514
self.assertEqual('', err)
516
# Create branch inside shared repository
517
repo.bzrdir.root_transport.mkdir('branch')
518
branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
519
out, err = self.runbzr('info repo/branch')
520
self.assertEqualDiff(
522
shared repository: %s
523
repository branch: branch
526
control: Meta directory format 1
527
branch: Branch format 5
536
""" % (repo.bzrdir.root_transport.base,
537
repo._format.get_format_description(),
539
self.assertEqual('', err)
541
# Create lightweight checkout
542
transport.mkdir('tree')
543
transport.mkdir('tree/lightcheckout')
544
dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
545
bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
546
dir2.create_workingtree()
547
tree2 = dir2.open_workingtree()
548
branch2 = tree2.branch
549
out, err = self.runbzr('info tree/lightcheckout')
550
self.assertEqualDiff(
552
light checkout root: %s
553
shared repository: %s
554
repository branch: branch
557
control: Meta directory format 1
558
working tree: Working tree format 3
559
branch: Branch format 5
570
0 versioned subdirectories
578
""" % (tree2.bzrdir.root_transport.base,
579
repo.bzrdir.root_transport.base,
580
repo._format.get_format_description(),
582
self.assertEqual('', err)
584
# Create normal checkout
585
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
586
branch3.bind(branch1)
587
tree3 = branch3.bzrdir.open_workingtree()
589
out, err = self.runbzr('info tree/checkout --verbose')
590
self.assertEqualDiff(
593
checkout of branch: %s
596
control: Meta directory format 1
597
working tree: Working tree format 3
598
branch: Branch format 5
609
0 versioned subdirectories
618
""" % (branch3.bzrdir.root_transport.base,
619
branch1.bzrdir.root_transport.base,
620
repo._format.get_format_description(),
622
self.assertEqual('', err)
624
# Update lightweight checkout
625
self.build_tree(['tree/lightcheckout/a'])
627
tree2.commit('commit one')
628
rev = repo.get_revision(branch2.revision_history()[0])
629
datestring_first = format_date(rev.timestamp, rev.timezone)
630
out, err = self.runbzr('info tree/lightcheckout --verbose')
631
self.assertEqualDiff(
633
light checkout root: %s
634
shared repository: %s
635
repository branch: branch
638
control: Meta directory format 1
639
working tree: Working tree format 3
640
branch: Branch format 5
651
0 versioned subdirectories
663
""" % (tree2.bzrdir.root_transport.base,
664
repo.bzrdir.root_transport.base,
665
repo._format.get_format_description(),
666
datestring_first, datestring_first,
667
# poking at _revision_store isn't all that clean, but neither is
668
# having the ui test dependent on the exact overhead of a given store.
669
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
671
self.assertEqual('', err)
673
# Out of date checkout
674
out, err = self.runbzr('info tree/checkout')
675
self.assertEqualDiff(
678
checkout of branch: %s
681
control: Meta directory format 1
682
working tree: Working tree format 3
683
branch: Branch format 5
686
Branch is out of date: missing 1 revision.
696
0 versioned subdirectories
704
""" % (tree3.bzrdir.root_transport.base,
705
branch1.bzrdir.root_transport.base,
706
repo._format.get_format_description(),
708
self.assertEqual('', err)
712
self.build_tree(['tree/checkout/b'])
714
out, err = self.runbzr('info tree/checkout --verbose')
715
self.assertEqualDiff(
718
checkout of branch: %s
721
control: Meta directory format 1
722
working tree: Working tree format 3
723
branch: Branch format 5
734
0 versioned subdirectories
746
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
747
repo._format.get_format_description(),
748
datestring_first, datestring_first,
749
# poking at _revision_store isn't all that clean, but neither is
750
# having the ui test dependent on the exact overhead of a given store.
751
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
753
self.assertEqual('', err)
754
tree3.commit('commit two')
756
# Out of date lightweight checkout
757
rev = repo.get_revision(branch1.revision_history()[-1])
758
datestring_last = format_date(rev.timestamp, rev.timezone)
759
out, err = self.runbzr('info tree/lightcheckout --verbose')
760
self.assertEqualDiff(
762
light checkout root: %s
763
shared repository: %s
764
repository branch: branch
767
control: Meta directory format 1
768
working tree: Working tree format 3
769
branch: Branch format 5
772
Working tree is out of date: missing 1 revision.
782
0 versioned subdirectories
794
""" % (tree2.bzrdir.root_transport.base,
795
repo.bzrdir.root_transport.base,
796
repo._format.get_format_description(),
797
datestring_first, datestring_last,
798
# poking at _revision_store isn't all that clean, but neither is
799
# having the ui test dependent on the exact overhead of a given store.
800
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
802
self.assertEqual('', err)
804
# Show info about shared branch
805
out, err = self.runbzr('info repo/branch --verbose')
806
self.assertEqualDiff(
808
shared repository: %s
809
repository branch: branch
812
control: Meta directory format 1
813
branch: Branch format 5
826
""" % (repo.bzrdir.root_transport.base,
827
repo._format.get_format_description(),
828
datestring_first, datestring_last,
829
# poking at _revision_store isn't all that clean, but neither is
830
# having the ui test dependent on the exact overhead of a given store.
831
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
833
self.assertEqual('', err)
835
# Show info about repository with revisions
836
out, err = self.runbzr('info repo')
837
self.assertEqualDiff(
839
shared repository: %s
842
control: Meta directory format 1
848
""" % (repo.bzrdir.root_transport.base,
849
repo._format.get_format_description(),
850
# poking at _revision_store isn't all that clean, but neither is
851
# having the ui test dependent on the exact overhead of a given store.
852
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
854
self.assertEqual('', err)
856
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
858
def test_info_shared_repository_with_trees(self):
859
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
860
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
861
transport = self.get_transport()
863
# Create shared repository with working trees
864
repo = self.make_repository('repo', shared=True)
865
repo.set_make_working_trees(True)
866
out, err = self.runbzr('info repo')
867
self.assertEqualDiff(
869
shared repository: %s
872
control: Meta directory format 1
875
Create working tree for new branches inside the repository.
880
""" % (repo.bzrdir.root_transport.base,
881
repo._format.get_format_description(),
883
self.assertEqual('', err)
885
# Create two branches
886
repo.bzrdir.root_transport.mkdir('branch1')
887
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
888
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
891
out, err = self.runbzr('info repo/branch1 --verbose')
892
self.assertEqualDiff(
894
shared repository: %s
895
repository checkout: branch1
898
control: Meta directory format 1
899
working tree: Working tree format 3
900
branch: Branch format 5
911
0 versioned subdirectories
920
""" % (repo.bzrdir.root_transport.base,
921
repo._format.get_format_description(),
923
self.assertEqual('', err)
925
# Update first branch
926
self.build_tree(['repo/branch1/a'])
927
tree1 = branch1.bzrdir.open_workingtree()
929
tree1.commit('commit one')
930
rev = repo.get_revision(branch1.revision_history()[0])
931
datestring_first = format_date(rev.timestamp, rev.timezone)
932
out, err = self.runbzr('info repo/branch1')
933
self.assertEqualDiff(
935
shared repository: %s
936
repository checkout: branch1
939
control: Meta directory format 1
940
working tree: Working tree format 3
941
branch: Branch format 5
952
0 versioned subdirectories
963
""" % (repo.bzrdir.root_transport.base,
964
repo._format.get_format_description(),
965
datestring_first, datestring_first,
966
# poking at _revision_store isn't all that clean, but neither is
967
# having the ui test dependent on the exact overhead of a given store.
968
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
970
self.assertEqual('', err)
972
# Out of date second branch
973
out, err = self.runbzr('info repo/branch2 --verbose')
974
self.assertEqualDiff(
976
shared repository: %s
977
repository checkout: branch2
983
control: Meta directory format 1
984
working tree: Working tree format 3
985
branch: Branch format 5
996
0 versioned subdirectories
1005
""" % (repo.bzrdir.root_transport.base,
1006
branch1.bzrdir.root_transport.base,
1007
repo._format.get_format_description(),
1008
# poking at _revision_store isn't all that clean, but neither is
1009
# having the ui test dependent on the exact overhead of a given store.
1010
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1012
self.assertEqual('', err)
1014
# Update second branch
1015
tree2 = branch2.bzrdir.open_workingtree()
1017
out, err = self.runbzr('info repo/branch2')
1018
self.assertEqualDiff(
1020
shared repository: %s
1021
repository checkout: branch2
1027
control: Meta directory format 1
1028
working tree: Working tree format 3
1029
branch: Branch format 5
1032
In the working tree:
1040
0 versioned subdirectories
1051
""" % (repo.bzrdir.root_transport.base,
1052
branch1.bzrdir.root_transport.base,
1053
repo._format.get_format_description(),
1054
datestring_first, datestring_first,
1055
# poking at _revision_store isn't all that clean, but neither is
1056
# having the ui test dependent on the exact overhead of a given store.
1057
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1059
self.assertEqual('', err)
1061
# Show info about repository with revisions
1062
out, err = self.runbzr('info repo')
1063
self.assertEqualDiff(
1065
shared repository: %s
1068
control: Meta directory format 1
1071
Create working tree for new branches inside the repository.
1076
""" % (repo.bzrdir.root_transport.base,
1077
repo._format.get_format_description(),
1078
# poking at _revision_store isn't all that clean, but neither is
1079
# having the ui test dependent on the exact overhead of a given store.
1080
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1083
self.assertEqual('', err)
1085
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1087
def test_info_shared_repository_with_tree_in_root(self):
1088
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
1089
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
1090
transport = self.get_transport()
1092
# Create shared repository with working trees
1093
repo = self.make_repository('repo', shared=True)
1094
repo.set_make_working_trees(True)
1095
out, err = self.runbzr('info repo')
1096
self.assertEqualDiff(
1098
shared repository: %s
1101
control: Meta directory format 1
1104
Create working tree for new branches inside the repository.
1109
""" % (repo.bzrdir.root_transport.base,
1110
repo._format.get_format_description(),
1112
self.assertEqual('', err)
1114
# Create branch in root of repository
1115
control = repo.bzrdir
1116
branch = control.create_branch()
1117
control.create_workingtree()
1118
out, err = self.runbzr('info repo')
1119
self.assertEqualDiff(
1121
shared repository: %s
1122
repository checkout: .
1125
control: Meta directory format 1
1126
working tree: Working tree format 3
1127
branch: Branch format 5
1130
In the working tree:
1138
0 versioned subdirectories
1146
""" % (repo.bzrdir.root_transport.base,
1147
repo._format.get_format_description(),
1149
self.assertEqual('', err)
1151
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1153
def test_info_locking(self):
1154
transport = self.get_transport()
1155
# Create shared repository with a branch
1156
repo = self.make_repository('repo', shared=True,
1157
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1158
repo.set_make_working_trees(False)
1159
repo.bzrdir.root_transport.mkdir('branch')
1160
repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1161
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1162
# Do a heavy checkout
1163
transport.mkdir('tree')
1164
transport.mkdir('tree/checkout')
1165
co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1166
format=bzrlib.bzrdir.BzrDirMetaFormat1())
1167
co_branch.bind(repo_branch)
1168
# Do a light checkout of the heavy one
1169
transport.mkdir('tree/lightcheckout')
1170
lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1171
bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1172
lco_dir.create_workingtree()
1173
lco_tree = lco_dir.open_workingtree()
1175
# Test all permutations of locking the working tree, branch and repository
1179
out, err = self.runbzr('info tree/lightcheckout')
1180
self.assertEqualDiff(
1182
light checkout root: %s
1183
checkout of branch: %s
1186
control: Meta directory format 1
1187
working tree: Working tree format 3
1188
branch: Branch format 5
1191
In the working tree:
1199
0 versioned subdirectories
1207
""" % (lco_tree.bzrdir.root_transport.base,
1208
lco_tree.branch.bzrdir.root_transport.base,
1209
lco_tree.branch.repository._format.get_format_description(),
1211
self.assertEqual('', err)
1213
lco_tree.branch.repository.lock_write()
1214
out, err = self.runbzr('info tree/lightcheckout')
1215
self.assertEqualDiff(
1217
light checkout root: %s
1218
checkout of branch: %s
1221
control: Meta directory format 1
1222
working tree: Working tree format 3
1223
branch: Branch format 5
1227
working tree: unlocked
1231
In the working tree:
1239
0 versioned subdirectories
1247
""" % (lco_tree.bzrdir.root_transport.base,
1248
lco_tree.branch.bzrdir.root_transport.base,
1249
lco_tree.branch.repository._format.get_format_description(),
1251
self.assertEqual('', err)
1252
lco_tree.branch.repository.unlock()
1254
lco_tree.branch.lock_write()
1255
out, err = self.runbzr('info tree/lightcheckout')
1256
self.assertEqualDiff(
1258
light checkout root: %s
1259
checkout of branch: %s
1262
control: Meta directory format 1
1263
working tree: Working tree format 3
1264
branch: Branch format 5
1268
working tree: unlocked
1272
In the working tree:
1280
0 versioned subdirectories
1288
""" % (lco_tree.bzrdir.root_transport.base,
1289
lco_tree.branch.bzrdir.root_transport.base,
1290
lco_tree.branch.repository._format.get_format_description(),
1292
self.assertEqual('', err)
1293
lco_tree.branch.unlock()
1295
lco_tree.lock_write()
1296
out, err = self.runbzr('info tree/lightcheckout')
1297
self.assertEqualDiff(
1299
light checkout root: %s
1300
checkout of branch: %s
1303
control: Meta directory format 1
1304
working tree: Working tree format 3
1305
branch: Branch format 5
1309
working tree: locked
1313
In the working tree:
1321
0 versioned subdirectories
1329
""" % (lco_tree.bzrdir.root_transport.base,
1330
lco_tree.branch.bzrdir.root_transport.base,
1331
lco_tree.branch.repository._format.get_format_description(),
1333
self.assertEqual('', err)
1336
lco_tree.lock_write()
1337
lco_tree.branch.repository.unlock()
1338
out, err = self.runbzr('info tree/lightcheckout')
1339
self.assertEqualDiff(
1341
light checkout root: %s
1342
checkout of branch: %s
1345
control: Meta directory format 1
1346
working tree: Working tree format 3
1347
branch: Branch format 5
1351
working tree: locked
1353
repository: unlocked
1355
In the working tree:
1363
0 versioned subdirectories
1371
""" % (lco_tree.bzrdir.root_transport.base,
1372
lco_tree.branch.bzrdir.root_transport.base,
1373
lco_tree.branch.repository._format.get_format_description(),
1375
self.assertEqual('', err)
1376
lco_tree.branch.repository.lock_write()
1379
lco_tree.lock_write()
1380
lco_tree.branch.unlock()
1381
out, err = self.runbzr('info tree/lightcheckout')
1382
self.assertEqualDiff(
1384
light checkout root: %s
1385
checkout of branch: %s
1388
control: Meta directory format 1
1389
working tree: Working tree format 3
1390
branch: Branch format 5
1394
working tree: locked
1396
repository: unlocked
1398
In the working tree:
1406
0 versioned subdirectories
1414
""" % (lco_tree.bzrdir.root_transport.base,
1415
lco_tree.branch.bzrdir.root_transport.base,
1416
lco_tree.branch.repository._format.get_format_description(),
1418
self.assertEqual('', err)
1419
lco_tree.branch.lock_write()
1422
lco_tree.lock_write()
1423
lco_tree.branch.unlock()
1424
lco_tree.branch.repository.lock_write()
1425
out, err = self.runbzr('info tree/lightcheckout')
1426
self.assertEqualDiff(
1428
light checkout root: %s
1429
checkout of branch: %s
1432
control: Meta directory format 1
1433
working tree: Working tree format 3
1434
branch: Branch format 5
1438
working tree: locked
1442
In the working tree:
1450
0 versioned subdirectories
1458
""" % (lco_tree.bzrdir.root_transport.base,
1459
lco_tree.branch.bzrdir.root_transport.base,
1460
lco_tree.branch.repository._format.get_format_description(),
1462
self.assertEqual('', err)
1463
lco_tree.branch.repository.unlock()
1464
lco_tree.branch.lock_write()
1467
lco_tree.branch.lock_write()
1468
lco_tree.branch.repository.unlock()
1469
out, err = self.runbzr('info tree/lightcheckout')
1470
self.assertEqualDiff(
1472
light checkout root: %s
1473
checkout of branch: %s
1476
control: Meta directory format 1
1477
working tree: Working tree format 3
1478
branch: Branch format 5
1482
working tree: unlocked
1484
repository: unlocked
1486
In the working tree:
1494
0 versioned subdirectories
1502
""" % (lco_tree.bzrdir.root_transport.base,
1503
lco_tree.branch.bzrdir.root_transport.base,
1504
lco_tree.branch.repository._format.get_format_description(),
1506
self.assertEqual('', err)
1507
lco_tree.branch.repository.lock_write()
1508
lco_tree.branch.unlock()
1510
def test_info_locking_oslocks(self):
1511
if sys.platform == "win32":
1512
raise TestSkipped("don't use oslocks on win32 in unix manner")
1514
tree = self.make_branch_and_tree('branch',
1515
format=bzrlib.bzrdir.BzrDirFormat6())
1517
# Test all permutations of locking the working tree, branch and repository
1518
# XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1519
# implemented by raising NotImplementedError and get_physical_lock_status()
1520
# always returns false. This makes bzr info hide the lock status. (Olaf)
1524
out, err = self.runbzr('info branch')
1525
self.assertEqualDiff(
1530
control: All-in-one format 6
1531
working tree: Working tree format 2
1532
branch: Branch format 4
1535
In the working tree:
1543
0 versioned subdirectories
1551
""" % (tree.bzrdir.root_transport.base,
1552
tree.branch.repository._format.get_format_description(),
1554
self.assertEqual('', err)
1557
out, err = self.runbzr('info branch')
1558
self.assertEqualDiff(
1563
control: All-in-one format 6
1564
working tree: Working tree format 2
1565
branch: Branch format 4
1568
In the working tree:
1576
0 versioned subdirectories
1584
""" % (tree.bzrdir.root_transport.base,
1585
tree.branch.repository._format.get_format_description(),
1587
self.assertEqual('', err)