27
30
class TestInfo(ExternalBase):
29
def test_info_standalone_trivial(self):
31
out, err = self.runbzr('info')
32
def test_info_standalone(self):
33
transport = self.get_transport()
35
# Create initial standalone branch
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)
40
self.build_tree(['standalone/a'])
42
branch1 = tree1.branch
43
out, err = self.runbzr('info standalone')
32
44
self.assertEqualDiff(
33
"""branch format: Bazaar-NG branch, format 6
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
43
0 versioned subdirectories
54
self.assertEqual('', err)
56
def test_info_up_to_date_checkout(self):
57
a_branch = self.make_branch_and_tree('branch')
58
self.runbzr('checkout branch checkout')
62
0 versioned subdirectories
70
""" % branch1.bzrdir.root_transport.base, out)
71
self.assertEqual('', err)
72
tree1.commit('commit one')
73
rev = branch1.repository.get_revision(branch1.revision_history()[0])
74
datestring_first = format_date(rev.timestamp, rev.timezone)
76
# Branch standalone with push location
77
branch2 = branch1.bzrdir.sprout('branch').open_branch()
78
branch2.set_push_location(branch1.bzrdir.root_transport.base)
79
out, err = self.runbzr('info branch --verbose')
87
control: All-in-one format 6
88
working tree: Working tree format 2
89
branch: Branch format 4
90
repository: Weave repository format 6
100
0 versioned subdirectories
112
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
113
branch1.bzrdir.root_transport.base,
114
datestring_first, datestring_first), out)
115
self.assertEqual('', err)
117
# Branch and bind to standalone, needs upgrade to metadir
118
# (creates backup as unknown)
119
# XXX: I can't get this to work through API
120
self.runbzr('branch standalone bound')
121
#branch3 = branch1.bzrdir.sprout('bound').open_branch()
122
self.runbzr('upgrade --format=metadir bound')
123
#bzrlib.upgrade.upgrade('bound', 'metadir')
124
branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
125
branch3.bind(branch1)
126
out, err = self.runbzr('info bound')
127
self.assertEqualDiff(
134
control: Meta directory format 1
135
working tree: Working tree format 3
136
branch: Branch format 5
147
0 versioned subdirectories
158
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
159
branch1.bzrdir.root_transport.base,
160
branch3.repository._format.get_format_description(),
161
datestring_first, datestring_first,
162
# poking at _revision_store isn't all that clean, but neither is
163
# having the ui test dependent on the exact overhead of a given store.
164
branch3.repository._revision_store.total_size(
165
branch3.repository.get_transaction())[1] / 1024,
167
self.assertEqual('', err)
169
# Checkout standalone (same as above, but does not have parent set)
170
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
171
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
172
branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
173
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
174
branch4.bind(branch1)
175
branch4.bzrdir.open_workingtree().update()
176
out, err = self.runbzr('info checkout --verbose')
177
self.assertEqualDiff(
183
control: Meta directory format 1
184
working tree: Working tree format 3
185
branch: Branch format 5
196
0 versioned subdirectories
208
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
209
branch4.repository._format.get_format_description(),
210
datestring_first, datestring_first,
211
# poking at _revision_store isn't all that clean, but neither is
212
# having the ui test dependent on the exact overhead of a given store.
213
branch4.repository._revision_store.total_size(
214
branch4.repository.get_transaction())[1] / 1024,
216
self.assertEqual('', err)
218
# Lightweight checkout (same as above, different branch and repository)
219
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
220
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
221
transport.mkdir('lightcheckout')
222
dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
223
bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
224
dir5.create_workingtree()
225
tree5 = dir5.open_workingtree()
226
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
227
branch5 = tree5.branch
228
out, err = self.runbzr('info lightcheckout')
229
self.assertEqualDiff(
232
checkout of branch: %s
235
control: Meta directory format 1
236
working tree: Working tree format 3
237
branch: Branch format 4
238
repository: Weave repository format 6
248
0 versioned subdirectories
259
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
260
datestring_first, datestring_first), out)
261
self.assertEqual('', err)
263
# Update initial standalone branch
264
self.build_tree(['standalone/b'])
266
tree1.commit('commit two')
267
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
268
datestring_last = format_date(rev.timestamp, rev.timezone)
270
# Out of date branched standalone branch will not be detected
271
out, err = self.runbzr('info branch')
272
self.assertEqualDiff(
279
control: All-in-one format 6
280
working tree: Working tree format 2
281
branch: Branch format 4
282
repository: Weave repository format 6
292
0 versioned subdirectories
303
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
304
branch1.bzrdir.root_transport.base,
305
datestring_first, datestring_first), out)
306
self.assertEqual('', err)
308
# Out of date bound branch
309
out, err = self.runbzr('info bound')
310
self.assertEqualDiff(
317
control: Meta directory format 1
318
working tree: Working tree format 3
319
branch: Branch format 5
322
Branch is out of date: missing 1 revision.
332
0 versioned subdirectories
343
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
344
branch1.bzrdir.root_transport.base,
345
branch3.repository._format.get_format_description(),
346
datestring_first, datestring_first,
347
# poking at _revision_store isn't all that clean, but neither is
348
# having the ui test dependent on the exact overhead of a given store.
349
branch3.repository._revision_store.total_size(
350
branch3.repository.get_transaction())[1] / 1024,
352
self.assertEqual('', err)
354
# Out of date checkout
59
355
out, err = self.runbzr('info checkout')
60
356
self.assertEqualDiff(
61
"""working tree format: Bazaar-NG Working Tree format 3
63
branch format: Bazaar-NG branch, format 6
73
0 versioned subdirectories
82
""" % a_branch.bzrdir.root_transport.base,
84
self.assertEqual('', err)
86
def test_info_out_of_date_standalone_tree(self):
87
# FIXME the default format has to change for this to pass
88
# because it currently uses the branch last-revision marker.
89
raise TestSkipped('default format too old')
90
self.make_branch_and_tree('branch')
92
self.runbzr('checkout branch checkout')
93
self.build_tree(['checkout/file'])
94
self.runbzr('add checkout/file')
95
self.runbzr('commit -m add-file checkout')
96
# now branch should be out of date
97
out,err = self.runbzr('update branch')
99
"""branch format: Bazaar-NG branch, format 6
101
Working tree is out of date: missing 1 revision.
110
0 versioned subdirectories
119
""" % a_branch.bzrdir.root_transport.base,
121
self.assertEqual('', err)
123
def test_info_out_of_date_checkout(self):
124
# note this deliberately uses a checkout at 'None' to
125
# test the out of date message with a revision notin the
127
a_branch = self.make_branch('branch')
129
self.runbzr('checkout branch checkout')
130
self.runbzr('checkout branch checkout2')
131
self.build_tree(['checkout/file'])
132
self.runbzr('add checkout/file')
133
self.runbzr('commit -m add-file checkout')
134
# now checkout2 should be out of date
135
out,err = self.runbzr('info checkout2')
136
rev = a_branch.repository.get_revision(a_branch.revision_history()[0])
137
datestring = format_date(rev.timestamp, rev.timezone)
138
self.assertEqualDiff(
139
"""working tree format: Bazaar-NG Working Tree format 3
141
branch format: Bazaar-NG branch, format 6
143
Working tree is out of date: missing 1 revision.
152
0 versioned subdirectories
362
control: Meta directory format 1
363
working tree: Working tree format 3
364
branch: Branch format 5
367
Branch is out of date: missing 1 revision.
377
0 versioned subdirectories
388
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
389
branch4.repository._format.get_format_description(),
390
datestring_first, datestring_first,
391
# poking at _revision_store isn't all that clean, but neither is
392
# having the ui test dependent on the exact overhead of a given store.
393
branch4.repository._revision_store.total_size(
394
branch4.repository.get_transaction())[1] / 1024,
396
self.assertEqual('', err)
398
# Out of date lightweight checkout
399
out, err = self.runbzr('info lightcheckout --verbose')
400
self.assertEqualDiff(
403
checkout of branch: %s
406
control: Meta directory format 1
407
working tree: Working tree format 3
408
branch: Branch format 4
409
repository: Weave repository format 6
411
Working tree is out of date: missing 1 revision.
421
0 versioned subdirectories
158
427
first revision: %s
159
428
latest revision: %s
164
""" % (a_branch.bzrdir.root_transport.base,
433
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
434
datestring_first, datestring_last), out)
435
self.assertEqual('', err)
437
def test_info_shared_repository(self):
438
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
439
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
440
transport = self.get_transport()
442
# Create shared repository
443
repo = self.make_repository('repo', shared=True)
444
repo.set_make_working_trees(False)
445
out, err = self.runbzr('info repo')
446
self.assertEqualDiff(
448
shared repository: %s
451
control: Meta directory format 1
457
""" % (repo.bzrdir.root_transport.base, repo._format.get_format_description()),
169
459
self.assertEqual('', err)
461
# Create branch inside shared repository
462
repo.bzrdir.root_transport.mkdir('branch')
463
branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
464
out, err = self.runbzr('info repo/branch')
465
self.assertEqualDiff(
468
shared repository: %s
471
control: Meta directory format 1
472
branch: Branch format 5
481
""" % (branch1.bzrdir.root_transport.base,
482
repo.bzrdir.root_transport.base,
483
repo._format.get_format_description(),
485
self.assertEqual('', err)
487
# Create lightweight checkout
488
transport.mkdir('tree')
489
transport.mkdir('tree/lightcheckout')
490
dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
491
bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
492
dir2.create_workingtree()
493
tree2 = dir2.open_workingtree()
494
branch2 = tree2.branch
495
out, err = self.runbzr('info tree/lightcheckout')
496
self.assertEqualDiff(
499
checkout of branch: %s
500
shared repository: %s
503
control: Meta directory format 1
504
working tree: Working tree format 3
505
branch: Branch format 5
516
0 versioned subdirectories
524
""" % (tree2.bzrdir.root_transport.base,
525
branch1.bzrdir.root_transport.base,
526
repo.bzrdir.root_transport.base,
527
repo._format.get_format_description(),
529
self.assertEqual('', err)
531
# Create normal checkout
532
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
533
branch3.bind(branch1)
534
tree3 = branch3.bzrdir.open_workingtree()
536
out, err = self.runbzr('info tree/checkout --verbose')
537
self.assertEqualDiff(
543
control: Meta directory format 1
544
working tree: Working tree format 3
545
branch: Branch format 5
556
0 versioned subdirectories
565
""" % (branch3.bzrdir.root_transport.base,
566
branch1.bzrdir.root_transport.base,
567
repo._format.get_format_description(),
569
self.assertEqual('', err)
571
# Update lightweight checkout
572
self.build_tree(['tree/lightcheckout/a'])
574
tree2.commit('commit one')
575
rev = repo.get_revision(branch2.revision_history()[0])
576
datestring_first = format_date(rev.timestamp, rev.timezone)
577
out, err = self.runbzr('info tree/lightcheckout --verbose')
578
self.assertEqualDiff(
581
checkout of branch: %s
582
shared repository: %s
585
control: Meta directory format 1
586
working tree: Working tree format 3
587
branch: Branch format 5
598
0 versioned subdirectories
610
""" % (tree2.bzrdir.root_transport.base,
611
branch1.bzrdir.root_transport.base,
612
repo.bzrdir.root_transport.base,
613
repo._format.get_format_description(),
614
datestring_first, datestring_first,
615
# poking at _revision_store isn't all that clean, but neither is
616
# having the ui test dependent on the exact overhead of a given store.
617
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
619
self.assertEqual('', err)
621
# Out of date checkout
622
out, err = self.runbzr('info tree/checkout')
623
self.assertEqualDiff(
629
control: Meta directory format 1
630
working tree: Working tree format 3
631
branch: Branch format 5
634
Branch is out of date: missing 1 revision.
644
0 versioned subdirectories
652
""" % (tree3.bzrdir.root_transport.base,
653
branch1.bzrdir.root_transport.base,
654
repo._format.get_format_description(),
656
self.assertEqual('', err)
660
self.build_tree(['tree/checkout/b'])
662
out, err = self.runbzr('info tree/checkout --verbose')
663
self.assertEqualDiff(
669
control: Meta directory format 1
670
working tree: Working tree format 3
671
branch: Branch format 5
682
0 versioned subdirectories
694
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
695
repo._format.get_format_description(),
696
datestring_first, datestring_first,
697
# poking at _revision_store isn't all that clean, but neither is
698
# having the ui test dependent on the exact overhead of a given store.
699
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
701
self.assertEqual('', err)
702
tree3.commit('commit two')
704
# Out of date lightweight checkout
705
rev = repo.get_revision(branch1.revision_history()[-1])
706
datestring_last = format_date(rev.timestamp, rev.timezone)
707
out, err = self.runbzr('info tree/lightcheckout --verbose')
708
self.assertEqualDiff(
711
checkout of branch: %s
712
shared repository: %s
715
control: Meta directory format 1
716
working tree: Working tree format 3
717
branch: Branch format 5
720
Working tree is out of date: missing 1 revision.
730
0 versioned subdirectories
742
""" % (tree2.bzrdir.root_transport.base,
743
branch1.bzrdir.root_transport.base,
744
repo.bzrdir.root_transport.base,
745
repo._format.get_format_description(),
746
datestring_first, datestring_last,
747
# poking at _revision_store isn't all that clean, but neither is
748
# having the ui test dependent on the exact overhead of a given store.
749
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
751
self.assertEqual('', err)
753
# Show info about shared branch
754
out, err = self.runbzr('info repo/branch --verbose')
755
self.assertEqualDiff(
758
shared repository: %s
761
control: Meta directory format 1
762
branch: Branch format 5
775
""" % (branch1.bzrdir.root_transport.base,
776
repo.bzrdir.root_transport.base,
777
repo._format.get_format_description(),
778
datestring_first, datestring_last,
779
# poking at _revision_store isn't all that clean, but neither is
780
# having the ui test dependent on the exact overhead of a given store.
781
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
783
self.assertEqual('', err)
785
# Show info about repository with revisions
786
out, err = self.runbzr('info repo')
787
self.assertEqualDiff(
789
shared repository: %s
792
control: Meta directory format 1
798
""" % (repo.bzrdir.root_transport.base,
799
repo._format.get_format_description(),
800
# poking at _revision_store isn't all that clean, but neither is
801
# having the ui test dependent on the exact overhead of a given store.
802
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
805
self.assertEqual('', err)
807
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
809
def test_info_shared_repository_with_trees(self):
810
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
811
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
812
transport = self.get_transport()
814
# Create shared repository with working trees
815
repo = self.make_repository('repo', shared=True)
816
repo.set_make_working_trees(True)
817
out, err = self.runbzr('info repo')
818
self.assertEqualDiff(
820
shared repository: %s
823
control: Meta directory format 1
826
Create working tree for new branches inside the repository.
831
""" % (repo.bzrdir.root_transport.base,
832
repo._format.get_format_description(),
834
self.assertEqual('', err)
836
# Create two branches
837
repo.bzrdir.root_transport.mkdir('branch1')
838
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
839
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
842
out, err = self.runbzr('info repo/branch1 --verbose')
843
self.assertEqualDiff(
846
shared repository: %s
849
control: Meta directory format 1
850
working tree: Working tree format 3
851
branch: Branch format 5
862
0 versioned subdirectories
871
""" % (branch1.bzrdir.root_transport.base,
872
repo.bzrdir.root_transport.base,
873
repo._format.get_format_description(),
875
self.assertEqual('', err)
877
# Update first branch
878
self.build_tree(['repo/branch1/a'])
879
tree1 = branch1.bzrdir.open_workingtree()
881
tree1.commit('commit one')
882
rev = repo.get_revision(branch1.revision_history()[0])
883
datestring_first = format_date(rev.timestamp, rev.timezone)
884
out, err = self.runbzr('info repo/branch1')
885
self.assertEqualDiff(
888
shared repository: %s
891
control: Meta directory format 1
892
working tree: Working tree format 3
893
branch: Branch format 5
904
0 versioned subdirectories
915
""" % (branch1.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
916
repo._format.get_format_description(),
917
datestring_first, datestring_first,
918
# poking at _revision_store isn't all that clean, but neither is
919
# having the ui test dependent on the exact overhead of a given store.
920
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
922
self.assertEqual('', err)
924
# Out of date second branch
925
out, err = self.runbzr('info repo/branch2 --verbose')
926
self.assertEqualDiff(
929
shared repository: %s
933
control: Meta directory format 1
934
working tree: Working tree format 3
935
branch: Branch format 5
946
0 versioned subdirectories
955
""" % (branch2.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
956
branch1.bzrdir.root_transport.base,
957
repo._format.get_format_description(),
958
# poking at _revision_store isn't all that clean, but neither is
959
# having the ui test dependent on the exact overhead of a given store.
960
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
962
self.assertEqual('', err)
964
# Update second branch
965
tree2 = branch2.bzrdir.open_workingtree()
967
out, err = self.runbzr('info repo/branch2')
968
self.assertEqualDiff(
971
shared repository: %s
975
control: Meta directory format 1
976
working tree: Working tree format 3
977
branch: Branch format 5
988
0 versioned subdirectories
999
""" % (branch2.bzrdir.root_transport.base,
1000
repo.bzrdir.root_transport.base,
1001
branch1.bzrdir.root_transport.base,
1002
repo._format.get_format_description(),
1003
datestring_first, datestring_first,
1004
# poking at _revision_store isn't all that clean, but neither is
1005
# having the ui test dependent on the exact overhead of a given store.
1006
repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1008
self.assertEqual('', err)
1010
# Show info about repository with revisions
1011
out, err = self.runbzr('info repo')
1012
self.assertEqualDiff(
1014
shared repository: %s
1017
control: Meta directory format 1
1020
Create working tree for new branches inside the repository.
1025
""" % (repo.bzrdir.root_transport.base,
1026
repo._format.get_format_description(),
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,
1032
self.assertEqual('', err)
1034
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)