27
30
class TestInfo(ExternalBase):
29
def test_info_standalone_trivial(self):
31
out, err = self.runbzr('info')
33
"""branch format: Bazaar-NG branch, 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')
59
out, err = self.runbzr('info checkout')
61
"""branch format: Bazaar-NG Metadir branch format 5
72
0 versioned subdirectories
81
""" % a_branch.bzrdir.root_transport.base,
83
self.assertEqual('', err)
85
def test_info_up_to_date_light_checkout(self):
86
a_branch = self.make_branch_and_tree('branch')
87
self.runbzr('checkout --lightweight branch checkout')
88
out, err = self.runbzr('info checkout')
90
"""working tree format: Bazaar-NG Working Tree format 3
92
branch format: Bazaar-NG branch, format 6
102
0 versioned subdirectories
111
""" % a_branch.bzrdir.root_transport.base,
113
self.assertEqual('', err)
115
def test_info_out_of_date_standalone_tree(self):
116
# FIXME the default format has to change for this to pass
117
# because it currently uses the branch last-revision marker.
118
raise TestSkipped('default format too old')
119
self.make_branch_and_tree('branch')
121
self.runbzr('checkout branch checkout')
122
self.build_tree(['checkout/file'])
123
self.runbzr('add checkout/file')
124
self.runbzr('commit -m add-file checkout')
125
# now branch should be out of date
126
out,err = self.runbzr('update branch')
127
self.assertEqualDiff(
128
"""branch format: Bazaar-NG branch, format 6
130
Working tree is out of date: missing 1 revision.
139
0 versioned subdirectories
148
""" % a_branch.bzrdir.root_transport.base,
150
self.assertEqual('', err)
152
def test_info_out_of_date_checkout(self):
153
# note this deliberately uses a checkout at 'None' to
154
# test the out of date message with a revision notin the
156
a_branch = self.make_branch('branch')
158
self.runbzr('checkout branch checkout')
159
self.runbzr('checkout branch checkout2')
160
self.build_tree(['checkout/file'])
161
self.runbzr('add checkout/file')
162
self.runbzr('commit -m add-file checkout')
163
# now checkout2 should be out of date
164
out,err = self.runbzr('info checkout2')
165
rev = a_branch.repository.get_revision(a_branch.revision_history()[0])
166
datestring = format_date(rev.timestamp, rev.timezone)
167
self.assertEqualDiff(
168
"""branch format: Bazaar-NG Metadir branch format 5
171
Branch is out of date: missing 1 revision.
180
0 versioned subdirectories
189
""" % (a_branch.bzrdir.root_transport.base,
192
self.assertEqual('', err)
194
def test_info_out_of_date_light_checkout(self):
195
# note this deliberately uses a checkout at 'None' to
196
# test the out of date message with a revision notin the
198
a_branch = self.make_branch('branch')
200
self.runbzr('checkout --lightweight branch checkout')
201
self.runbzr('checkout --lightweight branch checkout2')
202
self.build_tree(['checkout/file'])
203
self.runbzr('add checkout/file')
204
self.runbzr('commit -m add-file checkout')
205
# now checkout2 should be out of date
206
out,err = self.runbzr('info checkout2')
207
rev = a_branch.repository.get_revision(a_branch.revision_history()[0])
208
datestring = format_date(rev.timestamp, rev.timezone)
209
self.assertEqualDiff(
210
"""working tree format: Bazaar-NG Working Tree format 3
212
branch format: Bazaar-NG branch, format 6
214
Working tree is out of date: missing 1 revision.
223
0 versioned subdirectories
235
""" % (a_branch.bzrdir.root_transport.base,
240
self.assertEqual('', err)
242
def test_info_parent(self):
243
b = self.make_branch('.')
244
url = 'http://bazaar-vcs.org/bzr/bzr.dev/'
246
out,err = self.runbzr('info')
247
self.assertEqualDiff(
248
"""branch format: Bazaar-NG branch, format 6
258
0 versioned subdirectories
269
http://bazaar-vcs.org/bzr/bzr.dev/
271
self.assertEqual('', err)
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')
49
control: All-in-one format 6
50
working tree: Working tree format 2
51
branch: Branch format 4
52
repository: Weave repository format 6
62
0 versioned subdirectories
70
""" % branch1.bzrdir.root_transport.base, out)
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
137
repository: Weave repository format 7
147
0 versioned subdirectories
158
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
159
branch1.bzrdir.root_transport.base,
160
datestring_first, datestring_first), out)
161
self.assertEqual('', err)
163
# Checkout standalone (same as above, but does not have parent set)
164
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
165
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
166
branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
167
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
168
branch4.bind(branch1)
169
branch4.bzrdir.open_workingtree().update()
170
out, err = self.runbzr('info checkout --verbose')
171
self.assertEqualDiff(
177
control: Meta directory format 1
178
working tree: Working tree format 3
179
branch: Branch format 5
180
repository: Weave repository format 7
190
0 versioned subdirectories
202
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
203
datestring_first, datestring_first), out)
204
self.assertEqual('', err)
206
# Lightweight checkout (same as above, different branch and repository)
207
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
208
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
209
transport.mkdir('lightcheckout')
210
dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
211
bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
212
dir5.create_workingtree()
213
tree5 = dir5.open_workingtree()
214
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
215
branch5 = tree5.branch
216
out, err = self.runbzr('info lightcheckout')
217
self.assertEqualDiff(
220
checkout of branch: %s
223
control: Meta directory format 1
224
working tree: Working tree format 3
225
branch: Branch format 4
226
repository: Weave repository format 6
236
0 versioned subdirectories
247
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
248
datestring_first, datestring_first), out)
249
self.assertEqual('', err)
251
# Update initial standalone branch
252
self.build_tree(['standalone/b'])
254
tree1.commit('commit two')
255
rev = branch1.repository.get_revision(branch1.revision_history()[-1])
256
datestring_last = format_date(rev.timestamp, rev.timezone)
258
# Out of date branched standalone branch will not be detected
259
out, err = self.runbzr('info branch')
260
self.assertEqualDiff(
267
control: All-in-one format 6
268
working tree: Working tree format 2
269
branch: Branch format 4
270
repository: Weave repository format 6
280
0 versioned subdirectories
291
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
292
branch1.bzrdir.root_transport.base,
293
datestring_first, datestring_first), out)
294
self.assertEqual('', err)
296
# Out of date bound branch
297
out, err = self.runbzr('info bound')
298
self.assertEqualDiff(
305
control: Meta directory format 1
306
working tree: Working tree format 3
307
branch: Branch format 5
308
repository: Weave repository format 7
310
Branch is out of date: missing 1 revision.
320
0 versioned subdirectories
331
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
332
branch1.bzrdir.root_transport.base,
333
datestring_first, datestring_first), out)
334
self.assertEqual('', err)
336
# Out of date checkout
337
out, err = self.runbzr('info checkout')
338
self.assertEqualDiff(
344
control: Meta directory format 1
345
working tree: Working tree format 3
346
branch: Branch format 5
347
repository: Weave repository format 7
349
Branch is out of date: missing 1 revision.
359
0 versioned subdirectories
370
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
371
datestring_first, datestring_first), out)
372
self.assertEqual('', err)
374
# Out of date lightweight checkout
375
out, err = self.runbzr('info lightcheckout --verbose')
376
self.assertEqualDiff(
379
checkout of branch: %s
382
control: Meta directory format 1
383
working tree: Working tree format 3
384
branch: Branch format 4
385
repository: Weave repository format 6
387
Working tree is out of date: missing 1 revision.
397
0 versioned subdirectories
409
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
410
datestring_first, datestring_last), out)
411
self.assertEqual('', err)
413
def test_info_shared_repository(self):
414
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
415
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
416
transport = self.get_transport()
418
# Create shared repository
419
repo = self.make_repository('repo', shared=True)
420
repo.set_make_working_trees(False)
421
out, err = self.runbzr('info repo')
422
self.assertEqualDiff(
424
shared repository: %s
427
control: Meta directory format 1
428
repository: Weave repository format 7
433
""" % repo.bzrdir.root_transport.base, out)
434
self.assertEqual('', err)
436
# Create branch inside shared repository
437
repo.bzrdir.root_transport.mkdir('branch')
438
branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
439
out, err = self.runbzr('info repo/branch')
440
self.assertEqualDiff(
443
shared repository: %s
446
control: Meta directory format 1
447
branch: Branch format 5
448
repository: Weave repository format 7
456
""" % (branch1.bzrdir.root_transport.base,
457
repo.bzrdir.root_transport.base), out)
458
self.assertEqual('', err)
460
# Create lightweight checkout
461
transport.mkdir('tree')
462
transport.mkdir('tree/lightcheckout')
463
dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
464
bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
465
dir2.create_workingtree()
466
tree2 = dir2.open_workingtree()
467
branch2 = tree2.branch
468
out, err = self.runbzr('info tree/lightcheckout')
469
self.assertEqualDiff(
472
checkout of branch: %s
473
shared repository: %s
476
control: Meta directory format 1
477
working tree: Working tree format 3
478
branch: Branch format 5
479
repository: Weave repository format 7
489
0 versioned subdirectories
497
""" % (tree2.bzrdir.root_transport.base,
498
branch1.bzrdir.root_transport.base,
499
repo.bzrdir.root_transport.base), out)
500
self.assertEqual('', err)
502
# Create normal checkout
503
branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
504
branch3.bind(branch1)
505
tree3 = branch3.bzrdir.open_workingtree()
507
out, err = self.runbzr('info tree/checkout --verbose')
508
self.assertEqualDiff(
514
control: Meta directory format 1
515
working tree: Working tree format 3
516
branch: Branch format 5
517
repository: Weave repository format 7
527
0 versioned subdirectories
536
""" % (branch3.bzrdir.root_transport.base,
537
branch1.bzrdir.root_transport.base), out)
538
self.assertEqual('', err)
540
# Update lightweight checkout
541
self.build_tree(['tree/lightcheckout/a'])
543
tree2.commit('commit one')
544
rev = repo.get_revision(branch2.revision_history()[0])
545
datestring_first = format_date(rev.timestamp, rev.timezone)
546
out, err = self.runbzr('info tree/lightcheckout --verbose')
547
self.assertEqualDiff(
550
checkout of branch: %s
551
shared repository: %s
554
control: Meta directory format 1
555
working tree: Working tree format 3
556
branch: Branch format 5
557
repository: Weave repository format 7
567
0 versioned subdirectories
579
""" % (tree2.bzrdir.root_transport.base,
580
branch1.bzrdir.root_transport.base,
581
repo.bzrdir.root_transport.base,
582
datestring_first, datestring_first), out)
583
self.assertEqual('', err)
585
# Out of date checkout
586
out, err = self.runbzr('info tree/checkout')
587
self.assertEqualDiff(
593
control: Meta directory format 1
594
working tree: Working tree format 3
595
branch: Branch format 5
596
repository: Weave repository format 7
598
Branch is out of date: missing 1 revision.
608
0 versioned subdirectories
616
""" % (tree3.bzrdir.root_transport.base,
617
branch1.bzrdir.root_transport.base), out)
618
self.assertEqual('', err)
622
self.build_tree(['tree/checkout/b'])
624
out, err = self.runbzr('info tree/checkout --verbose')
625
self.assertEqualDiff(
631
control: Meta directory format 1
632
working tree: Working tree format 3
633
branch: Branch format 5
634
repository: Weave repository format 7
644
0 versioned subdirectories
656
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
657
datestring_first, datestring_first), out)
658
self.assertEqual('', err)
659
tree3.commit('commit two')
661
# Out of date lightweight checkout
662
rev = repo.get_revision(branch1.revision_history()[-1])
663
datestring_last = format_date(rev.timestamp, rev.timezone)
664
out, err = self.runbzr('info tree/lightcheckout --verbose')
665
self.assertEqualDiff(
668
checkout of branch: %s
669
shared repository: %s
672
control: Meta directory format 1
673
working tree: Working tree format 3
674
branch: Branch format 5
675
repository: Weave repository format 7
677
Working tree is out of date: missing 1 revision.
687
0 versioned subdirectories
699
""" % (tree2.bzrdir.root_transport.base,
700
branch1.bzrdir.root_transport.base,
701
repo.bzrdir.root_transport.base,
702
datestring_first, datestring_last), out)
703
self.assertEqual('', err)
705
# Show info about shared branch
706
out, err = self.runbzr('info repo/branch --verbose')
707
self.assertEqualDiff(
710
shared repository: %s
713
control: Meta directory format 1
714
branch: Branch format 5
715
repository: Weave repository format 7
727
""" % (branch1.bzrdir.root_transport.base,
728
repo.bzrdir.root_transport.base,
729
datestring_first, datestring_last), out)
730
self.assertEqual('', err)
732
# Show info about repository with revisions
733
out, err = self.runbzr('info repo')
734
self.assertEqualDiff(
736
shared repository: %s
739
control: Meta directory format 1
740
repository: Weave repository format 7
745
""" % repo.bzrdir.root_transport.base, out)
746
self.assertEqual('', err)
748
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
750
def test_info_shared_repository_with_trees(self):
751
old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
752
bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
753
transport = self.get_transport()
755
# Create shared repository with working trees
756
repo = self.make_repository('repo', shared=True)
757
repo.set_make_working_trees(True)
758
out, err = self.runbzr('info repo')
759
self.assertEqualDiff(
761
shared repository: %s
764
control: Meta directory format 1
765
repository: Weave repository format 7
767
Create working tree for new branches inside the repository.
772
""" % repo.bzrdir.root_transport.base, out)
773
self.assertEqual('', err)
775
# Create two branches
776
repo.bzrdir.root_transport.mkdir('branch1')
777
branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
778
branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
781
out, err = self.runbzr('info repo/branch1 --verbose')
782
self.assertEqualDiff(
785
shared repository: %s
788
control: Meta directory format 1
789
working tree: Working tree format 3
790
branch: Branch format 5
791
repository: Weave repository format 7
801
0 versioned subdirectories
810
""" % (branch1.bzrdir.root_transport.base,
811
repo.bzrdir.root_transport.base), out)
812
self.assertEqual('', err)
814
# Update first branch
815
self.build_tree(['repo/branch1/a'])
816
tree1 = branch1.bzrdir.open_workingtree()
818
tree1.commit('commit one')
819
rev = repo.get_revision(branch1.revision_history()[0])
820
datestring_first = format_date(rev.timestamp, rev.timezone)
821
out, err = self.runbzr('info repo/branch1')
822
self.assertEqualDiff(
825
shared repository: %s
828
control: Meta directory format 1
829
working tree: Working tree format 3
830
branch: Branch format 5
831
repository: Weave repository format 7
841
0 versioned subdirectories
852
""" % (branch1.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
853
datestring_first, datestring_first), out)
854
self.assertEqual('', err)
856
# Out of date second branch
857
out, err = self.runbzr('info repo/branch2 --verbose')
858
self.assertEqualDiff(
861
shared repository: %s
865
control: Meta directory format 1
866
working tree: Working tree format 3
867
branch: Branch format 5
868
repository: Weave repository format 7
878
0 versioned subdirectories
887
""" % (branch2.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
888
branch1.bzrdir.root_transport.base), out)
889
self.assertEqual('', err)
891
# Update second branch
892
tree2 = branch2.bzrdir.open_workingtree()
894
out, err = self.runbzr('info repo/branch2')
895
self.assertEqualDiff(
898
shared repository: %s
902
control: Meta directory format 1
903
working tree: Working tree format 3
904
branch: Branch format 5
905
repository: Weave repository format 7
915
0 versioned subdirectories
926
""" % (branch2.bzrdir.root_transport.base,
927
repo.bzrdir.root_transport.base,
928
branch1.bzrdir.root_transport.base,
929
datestring_first, datestring_first), out)
930
self.assertEqual('', err)
932
# Show info about repository with revisions
933
out, err = self.runbzr('info repo')
934
self.assertEqualDiff(
936
shared repository: %s
939
control: Meta directory format 1
940
repository: Weave repository format 7
942
Create working tree for new branches inside the repository.
947
""" % repo.bzrdir.root_transport.base, out)
948
self.assertEqual('', err)
950
bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)