~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_info.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-03 10:06:19 UTC
  • mfrom: (4999.3.2 apport)
  • Revision ID: pqm@pqm.ubuntu.com-20100203100619-f76bo5y5bd5c14wk
(mbp) use apport to send bugs, not just store them

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
17
17
 
18
18
"""Tests for the info command of bzr."""
19
19
 
20
 
import shutil
21
20
import sys
22
21
 
23
22
from bzrlib import (
24
23
    branch,
25
24
    bzrdir,
26
 
    controldir,
27
25
    errors,
28
26
    info,
29
27
    osutils,
30
 
    tests,
31
28
    upgrade,
32
29
    urlutils,
33
30
    )
34
 
from bzrlib.tests.matchers import ContainsNoVfsCalls
35
 
from bzrlib.transport import memory
36
 
 
37
 
 
38
 
class TestInfo(tests.TestCaseWithTransport):
 
31
from bzrlib.osutils import format_date
 
32
from bzrlib.tests import TestSkipped, MemoryServer
 
33
from bzrlib.tests.blackbox import ExternalBase
 
34
 
 
35
 
 
36
class TestInfo(ExternalBase):
39
37
 
40
38
    def setUp(self):
41
 
        super(TestInfo, self).setUp()
 
39
        ExternalBase.setUp(self)
42
40
        self._repo_strings = "2a"
43
41
 
44
42
    def test_info_non_existing(self):
45
 
        self.vfs_transport_factory = memory.MemoryServer
 
43
        self.vfs_transport_factory = MemoryServer
46
44
        location = self.get_url()
47
45
        out, err = self.run_bzr('info '+location, retcode=3)
48
46
        self.assertEqual(out, '')
49
47
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
50
48
 
51
 
    def test_info_empty_controldir(self):
52
 
        self.make_bzrdir('ctrl')
53
 
        out, err = self.run_bzr('info ctrl')
54
 
        self.assertEquals(out,
55
 
            'Empty control directory (format: 2a or pack-0.92)\n'
56
 
            'Location:\n'
57
 
            '  control directory: ctrl\n')
58
 
        self.assertEquals(err, '')
59
 
 
60
 
    def test_info_dangling_branch_reference(self):
61
 
        br = self.make_branch('target')
62
 
        br.create_checkout('from', lightweight=True)
63
 
        shutil.rmtree('target')
64
 
        out, err = self.run_bzr('info from')
65
 
        self.assertEquals(out,
66
 
            'Dangling branch reference (format: 2a or pack-0.92)\n'
67
 
            'Location:\n'
68
 
            '   control directory: from\n'
69
 
            '  checkout of branch: target\n')
70
 
        self.assertEquals(err, '')
71
 
 
72
49
    def test_info_standalone(self):
73
50
        transport = self.get_transport()
74
51
 
75
52
        # Create initial standalone branch
76
 
        tree1 = self.make_branch_and_tree('standalone', 'knit')
 
53
        tree1 = self.make_branch_and_tree('standalone', 'weave')
77
54
        self.build_tree(['standalone/a'])
78
55
        tree1.add('a')
79
56
        branch1 = tree1.branch
80
57
 
81
58
        out, err = self.run_bzr('info standalone')
82
59
        self.assertEqualDiff(
83
 
"""Standalone tree (format: knit)
 
60
"""Standalone tree (format: weave)
84
61
Location:
85
62
  branch root: standalone
86
63
""", out)
89
66
        # Standalone branch - verbose mode
90
67
        out, err = self.run_bzr('info standalone -v')
91
68
        self.assertEqualDiff(
92
 
"""Standalone tree (format: knit)
 
69
"""Standalone tree (format: weave)
93
70
Location:
94
71
  branch root: standalone
95
72
 
96
73
Format:
97
 
       control: Meta directory format 1
98
 
  working tree: Working tree format 3
99
 
        branch: Branch format 5
100
 
    repository: Knit repository format 1
101
 
 
102
 
Control directory:
103
 
         1 branches
 
74
       control: All-in-one format 6
 
75
  working tree: Working tree format 2
 
76
        branch: Branch format 4
 
77
    repository: Weave repository format 6
104
78
 
105
79
In the working tree:
106
80
         0 unchanged
123
97
        # Standalone branch - really verbose mode
124
98
        out, err = self.run_bzr('info standalone -vv')
125
99
        self.assertEqualDiff(
126
 
"""Standalone tree (format: knit)
 
100
"""Standalone tree (format: weave)
127
101
Location:
128
102
  branch root: standalone
129
103
 
130
104
Format:
131
 
       control: Meta directory format 1
132
 
  working tree: Working tree format 3
133
 
        branch: Branch format 5
134
 
    repository: Knit repository format 1
135
 
 
136
 
Control directory:
137
 
         1 branches
 
105
       control: All-in-one format 6
 
106
  working tree: Working tree format 2
 
107
        branch: Branch format 4
 
108
    repository: Weave repository format 6
138
109
 
139
110
In the working tree:
140
111
         0 unchanged
155
126
""", out)
156
127
        self.assertEqual('', err)
157
128
        tree1.commit('commit one')
158
 
        rev = branch1.repository.get_revision(branch1.last_revision())
159
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
129
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
 
130
        datestring_first = format_date(rev.timestamp, rev.timezone)
160
131
 
161
132
        # Branch standalone with push location
162
133
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
164
135
 
165
136
        out, err = self.run_bzr('info branch')
166
137
        self.assertEqualDiff(
167
 
"""Standalone tree (format: knit)
 
138
"""Standalone tree (format: weave)
168
139
Location:
169
140
  branch root: branch
170
141
 
176
147
 
177
148
        out, err = self.run_bzr('info branch --verbose')
178
149
        self.assertEqualDiff(
179
 
"""Standalone tree (format: knit)
 
150
"""Standalone tree (format: weave)
180
151
Location:
181
152
  branch root: branch
182
153
 
185
156
  parent branch: standalone
186
157
 
187
158
Format:
188
 
       control: Meta directory format 1
189
 
  working tree: Working tree format 3
190
 
        branch: Branch format 5
191
 
    repository: Knit repository format 1
192
 
 
193
 
Control directory:
194
 
         1 branches
 
159
       control: All-in-one format 6
 
160
  working tree: Working tree format 2
 
161
        branch: Branch format 4
 
162
    repository: Weave repository format 6
195
163
 
196
164
In the working tree:
197
165
         1 unchanged
220
188
        branch1.bzrdir.sprout('bound')
221
189
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
222
190
        upgrade.upgrade('bound', knit1_format)
223
 
        branch3 = controldir.ControlDir.open('bound').open_branch()
 
191
        branch3 = bzrdir.BzrDir.open('bound').open_branch()
224
192
        branch3.bind(branch1)
225
193
        bound_tree = branch3.bzrdir.open_workingtree()
226
194
        out, err = self.run_bzr('info -v bound')
239
207
        branch: %s
240
208
    repository: %s
241
209
 
242
 
Control directory:
243
 
         1 branches
244
 
 
245
210
In the working tree:
246
211
         1 unchanged
247
212
         0 modified
248
213
         0 added
249
214
         0 removed
250
215
         0 renamed
251
 
         0 unknown
 
216
         1 unknown
252
217
         0 ignored
253
218
         0 versioned subdirectories
254
219
 
268
233
        self.assertEqual('', err)
269
234
 
270
235
        # Checkout standalone (same as above, but does not have parent set)
271
 
        branch4 = controldir.ControlDir.create_branch_convenience('checkout',
 
236
        branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
272
237
            format=knit1_format)
273
238
        branch4.bind(branch1)
274
239
        branch4.bzrdir.open_workingtree().update()
285
250
        branch: Branch format 5
286
251
    repository: %s
287
252
 
288
 
Control directory:
289
 
         1 branches
290
 
 
291
253
In the working tree:
292
254
         1 unchanged
293
255
         0 modified
315
277
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
316
278
        branch5 = tree5.branch
317
279
        out, err = self.run_bzr('info -v lightcheckout')
318
 
        if "metaweave" in bzrdir.format_registry:
319
 
            format_description = "knit or metaweave"
320
 
        else:
321
 
            format_description = "knit"
322
280
        self.assertEqualDiff(
323
281
"""Lightweight checkout (format: %s)
324
282
Location:
327
285
 
328
286
Format:
329
287
       control: Meta directory format 1
330
 
  working tree: Working tree format 3
331
 
        branch: Branch format 5
332
 
    repository: Knit repository format 1
333
 
 
334
 
Control directory:
335
 
         1 branches
 
288
  working tree: Working tree format 6
 
289
        branch: Branch format 4
 
290
    repository: Weave repository format 6
336
291
 
337
292
In the working tree:
338
293
         1 unchanged
352
307
 
353
308
Repository:
354
309
         1 revision
355
 
""" % (format_description, datestring_first, datestring_first,), out)
 
310
""" % (self._repo_strings, datestring_first, datestring_first,), out)
356
311
        self.assertEqual('', err)
357
312
 
358
313
        # Update initial standalone branch
359
314
        self.build_tree(['standalone/b'])
360
315
        tree1.add('b')
361
316
        tree1.commit('commit two')
362
 
        rev = branch1.repository.get_revision(branch1.last_revision())
363
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
 
317
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
 
318
        datestring_last = format_date(rev.timestamp, rev.timezone)
364
319
 
365
320
        # Out of date branched standalone branch will not be detected
366
321
        out, err = self.run_bzr('info -v branch')
367
322
        self.assertEqualDiff(
368
 
"""Standalone tree (format: knit)
 
323
"""Standalone tree (format: weave)
369
324
Location:
370
325
  branch root: branch
371
326
 
374
329
  parent branch: standalone
375
330
 
376
331
Format:
377
 
       control: Meta directory format 1
378
 
  working tree: Working tree format 3
379
 
        branch: Branch format 5
380
 
    repository: Knit repository format 1
381
 
 
382
 
Control directory:
383
 
         1 branches
 
332
       control: All-in-one format 6
 
333
  working tree: Working tree format 2
 
334
        branch: Branch format 4
 
335
    repository: Weave repository format 6
384
336
 
385
337
In the working tree:
386
338
         1 unchanged
421
373
        branch: Branch format 5
422
374
    repository: %s
423
375
 
424
 
Control directory:
425
 
         1 branches
426
 
 
427
376
Branch is out of date: missing 1 revision.
428
377
 
429
378
In the working tree:
432
381
         0 added
433
382
         0 removed
434
383
         0 renamed
435
 
         0 unknown
 
384
         1 unknown
436
385
         0 ignored
437
386
         0 versioned subdirectories
438
387
 
463
412
        branch: Branch format 5
464
413
    repository: %s
465
414
 
466
 
Control directory:
467
 
         1 branches
468
 
 
469
415
Branch is out of date: missing 1 revision.
470
416
 
471
417
In the working tree:
501
447
 
502
448
Format:
503
449
       control: Meta directory format 1
504
 
  working tree: Working tree format 3
505
 
        branch: Branch format 5
506
 
    repository: Knit repository format 1
507
 
 
508
 
Control directory:
509
 
         1 branches
 
450
  working tree: Working tree format 6
 
451
        branch: Branch format 4
 
452
    repository: Weave repository format 6
510
453
 
511
454
Working tree is out of date: missing 1 revision.
512
455
 
528
471
 
529
472
Repository:
530
473
         2 revisions
531
 
""" % (format_description, datestring_first, datestring_last,), out)
 
474
""" % (self._repo_strings, datestring_first, datestring_last,), out)
532
475
        self.assertEqual('', err)
533
476
 
534
477
    def test_info_standalone_no_tree(self):
547
490
        branch: %s
548
491
    repository: %s
549
492
 
550
 
Control directory:
551
 
         1 branches
552
 
 
553
493
Branch history:
554
494
         0 revisions
555
495
 
578
518
       control: Meta directory format 1
579
519
    repository: %s
580
520
 
581
 
Control directory:
582
 
         0 branches
583
 
 
584
521
Repository:
585
522
         0 revisions
586
523
""" % ('repo', format.repository_format.get_format_description(),
589
526
 
590
527
        # Create branch inside shared repository
591
528
        repo.bzrdir.root_transport.mkdir('branch')
592
 
        branch1 = controldir.ControlDir.create_branch_convenience(
593
 
            'repo/branch', format=format)
 
529
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
 
530
            format=format)
594
531
        out, err = self.run_bzr('info -v repo/branch')
595
532
        self.assertEqualDiff(
596
533
"""Repository branch (format: dirstate or knit)
603
540
        branch: %s
604
541
    repository: %s
605
542
 
606
 
Control directory:
607
 
         1 branches
608
 
 
609
543
Branch history:
610
544
         0 revisions
611
545
 
634
568
        self.build_tree(['tree/lightcheckout/a'])
635
569
        tree2.add('a')
636
570
        tree2.commit('commit one')
637
 
        rev = repo.get_revision(branch2.last_revision())
638
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
571
        rev = repo.get_revision(branch2.revision_history()[0])
 
572
        datestring_first = format_date(rev.timestamp, rev.timezone)
639
573
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
640
574
        self.assertEqualDiff(
641
575
"""Lightweight checkout (format: %s)
650
584
        branch: %s
651
585
    repository: %s
652
586
 
653
 
Control directory:
654
 
         1 branches
655
 
 
656
587
In the working tree:
657
588
         1 unchanged
658
589
         0 modified
691
622
        branch: %s
692
623
    repository: %s
693
624
 
694
 
Control directory:
695
 
         1 branches
696
 
 
697
625
Branch is out of date: missing 1 revision.
698
626
 
699
627
In the working tree:
733
661
        branch: %s
734
662
    repository: %s
735
663
 
736
 
Control directory:
737
 
         1 branches
738
 
 
739
664
In the working tree:
740
665
         1 unchanged
741
666
         0 modified
762
687
        tree3.commit('commit two')
763
688
 
764
689
        # Out of date lightweight checkout
765
 
        rev = repo.get_revision(branch1.last_revision())
766
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
 
690
        rev = repo.get_revision(branch1.revision_history()[-1])
 
691
        datestring_last = format_date(rev.timestamp, rev.timezone)
767
692
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
768
693
        self.assertEqualDiff(
769
694
"""Lightweight checkout (format: %s)
778
703
        branch: %s
779
704
    repository: %s
780
705
 
781
 
Control directory:
782
 
         1 branches
783
 
 
784
706
Working tree is out of date: missing 1 revision.
785
707
 
786
708
In the working tree:
820
742
        branch: %s
821
743
    repository: %s
822
744
 
823
 
Control directory:
824
 
         1 branches
825
 
 
826
745
Branch history:
827
746
         2 revisions
828
747
         0 days old
848
767
       control: Meta directory format 1
849
768
    repository: %s
850
769
 
851
 
Control directory:
852
 
         0 branches
853
 
 
854
770
Repository:
855
771
         2 revisions
856
772
""" % (format.repository_format.get_format_description(),
874
790
       control: Meta directory format 1
875
791
    repository: %s
876
792
 
877
 
Control directory:
878
 
         0 branches
879
 
 
880
793
Create working tree for new branches inside the repository.
881
794
 
882
795
Repository:
887
800
 
888
801
        # Create two branches
889
802
        repo.bzrdir.root_transport.mkdir('branch1')
890
 
        branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
 
803
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
891
804
            format=format)
892
805
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
893
806
 
905
818
        branch: %s
906
819
    repository: %s
907
820
 
908
 
Control directory:
909
 
         1 branches
910
 
 
911
821
In the working tree:
912
822
         0 unchanged
913
823
         0 modified
933
843
        tree1 = branch1.bzrdir.open_workingtree()
934
844
        tree1.add('a')
935
845
        tree1.commit('commit one')
936
 
        rev = repo.get_revision(branch1.last_revision())
937
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
846
        rev = repo.get_revision(branch1.revision_history()[0])
 
847
        datestring_first = format_date(rev.timestamp, rev.timezone)
938
848
        out, err = self.run_bzr('info -v repo/branch1')
939
849
        self.assertEqualDiff(
940
850
"""Repository tree (format: knit)
948
858
        branch: %s
949
859
    repository: %s
950
860
 
951
 
Control directory:
952
 
         1 branches
953
 
 
954
861
In the working tree:
955
862
         1 unchanged
956
863
         0 modified
992
899
        branch: %s
993
900
    repository: %s
994
901
 
995
 
Control directory:
996
 
         1 branches
997
 
 
998
902
In the working tree:
999
903
         0 unchanged
1000
904
         0 modified
1034
938
        branch: %s
1035
939
    repository: %s
1036
940
 
1037
 
Control directory:
1038
 
         1 branches
1039
 
 
1040
941
In the working tree:
1041
942
         1 unchanged
1042
943
         0 modified
1072
973
       control: Meta directory format 1
1073
974
    repository: %s
1074
975
 
1075
 
Control directory:
1076
 
         0 branches
1077
 
 
1078
976
Create working tree for new branches inside the repository.
1079
977
 
1080
978
Repository:
1101
999
       control: Meta directory format 1
1102
1000
    repository: %s
1103
1001
 
1104
 
Control directory:
1105
 
         0 branches
1106
 
 
1107
1002
Create working tree for new branches inside the repository.
1108
1003
 
1109
1004
Repository:
1129
1024
        branch: %s
1130
1025
    repository: %s
1131
1026
 
1132
 
Control directory:
1133
 
         1 branches
1134
 
 
1135
1027
In the working tree:
1136
1028
         0 unchanged
1137
1029
         0 modified
1169
1061
       control: Meta directory format 1
1170
1062
    repository: %s
1171
1063
 
1172
 
Control directory:
1173
 
         0 branches
1174
 
 
1175
1064
Create working tree for new branches inside the repository.
1176
1065
 
1177
1066
Repository:
1181
1070
       ), out)
1182
1071
        self.assertEqual('', err)
1183
1072
 
1184
 
    def test_info_unshared_repository_with_colocated_branches(self):
1185
 
        format = bzrdir.format_registry.make_bzrdir('development-colo')
1186
 
        transport = self.get_transport()
1187
 
 
1188
 
        # Create unshared repository
1189
 
        repo = self.make_repository('repo', shared=False, format=format)
1190
 
        repo.set_make_working_trees(True)
1191
 
        repo.bzrdir.create_branch(name='foo')
1192
 
        out, err = self.run_bzr('info repo')
1193
 
        self.assertEqualDiff(
1194
 
"""Unshared repository with trees and colocated branches (format: development-colo)
1195
 
Location:
1196
 
  repository: repo
1197
 
""", out)
1198
 
        self.assertEqual('', err)
1199
 
 
1200
1073
    def assertCheckoutStatusOutput(self,
1201
1074
        command_string, lco_tree, shared_repo=None,
1202
1075
        repo_branch=None,
1311
1184
        branch: %s
1312
1185
    repository: %s
1313
1186
%s
1314
 
Control directory:
1315
 
         1 branches
1316
 
 
1317
1187
In the working tree:
1318
1188
         0 unchanged
1319
1189
         0 modified
1348
1218
                                    format=bzrdir.BzrDirMetaFormat1())
1349
1219
        repo.set_make_working_trees(False)
1350
1220
        repo.bzrdir.root_transport.mkdir('branch')
1351
 
        repo_branch = controldir.ControlDir.create_branch_convenience(
1352
 
            'repo/branch', format=bzrdir.BzrDirMetaFormat1())
 
1221
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
 
1222
                                    format=bzrdir.BzrDirMetaFormat1())
1353
1223
        # Do a heavy checkout
1354
1224
        transport.mkdir('tree')
1355
1225
        transport.mkdir('tree/checkout')
1356
 
        co_branch = controldir.ControlDir.create_branch_convenience(
1357
 
            'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
 
1226
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1227
            format=bzrdir.BzrDirMetaFormat1())
1358
1228
        co_branch.bind(repo_branch)
1359
1229
        # Do a light checkout of the heavy one
1360
1230
        transport.mkdir('tree/lightcheckout')
1361
1231
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1362
 
        lco_dir.set_branch_reference(co_branch)
 
1232
        branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1363
1233
        lco_dir.create_workingtree()
1364
1234
        lco_tree = lco_dir.open_workingtree()
1365
1235
 
1453
1323
            self.knownFailure('Win32 cannot run "bzr info"'
1454
1324
                              ' when the tree is locked.')
1455
1325
 
 
1326
    def test_info_locking_oslocks(self):
 
1327
        if sys.platform == "win32":
 
1328
            raise TestSkipped("don't use oslocks on win32 in unix manner")
 
1329
        # This test tests old (all-in-one, OS lock using) behaviour which
 
1330
        # simply cannot work on windows (and is indeed why we changed our
 
1331
        # design. As such, don't try to remove the thisFailsStrictLockCheck
 
1332
        # call here.
 
1333
        self.thisFailsStrictLockCheck()
 
1334
 
 
1335
        tree = self.make_branch_and_tree('branch',
 
1336
                                         format=bzrdir.BzrDirFormat6())
 
1337
 
 
1338
        # Test all permutations of locking the working tree, branch and repository
 
1339
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
 
1340
        # implemented by raising NotImplementedError and get_physical_lock_status()
 
1341
        # always returns false. This makes bzr info hide the lock status.  (Olaf)
 
1342
        # W B R
 
1343
 
 
1344
        # U U U
 
1345
        out, err = self.run_bzr('info -v branch')
 
1346
        self.assertEqualDiff(
 
1347
"""Standalone tree (format: weave)
 
1348
Location:
 
1349
  branch root: %s
 
1350
 
 
1351
Format:
 
1352
       control: All-in-one format 6
 
1353
  working tree: Working tree format 2
 
1354
        branch: Branch format 4
 
1355
    repository: %s
 
1356
 
 
1357
In the working tree:
 
1358
         0 unchanged
 
1359
         0 modified
 
1360
         0 added
 
1361
         0 removed
 
1362
         0 renamed
 
1363
         0 unknown
 
1364
         0 ignored
 
1365
         0 versioned subdirectories
 
1366
 
 
1367
Branch history:
 
1368
         0 revisions
 
1369
 
 
1370
Repository:
 
1371
         0 revisions
 
1372
""" % ('branch', tree.branch.repository._format.get_format_description(),
 
1373
       ), out)
 
1374
        self.assertEqual('', err)
 
1375
        # L L L
 
1376
        tree.lock_write()
 
1377
        out, err = self.run_bzr('info -v branch')
 
1378
        self.assertEqualDiff(
 
1379
"""Standalone tree (format: weave)
 
1380
Location:
 
1381
  branch root: %s
 
1382
 
 
1383
Format:
 
1384
       control: All-in-one format 6
 
1385
  working tree: Working tree format 2
 
1386
        branch: Branch format 4
 
1387
    repository: %s
 
1388
 
 
1389
In the working tree:
 
1390
         0 unchanged
 
1391
         0 modified
 
1392
         0 added
 
1393
         0 removed
 
1394
         0 renamed
 
1395
         0 unknown
 
1396
         0 ignored
 
1397
         0 versioned subdirectories
 
1398
 
 
1399
Branch history:
 
1400
         0 revisions
 
1401
 
 
1402
Repository:
 
1403
         0 revisions
 
1404
""" % ('branch', tree.branch.repository._format.get_format_description(),
 
1405
       ), out)
 
1406
        self.assertEqual('', err)
 
1407
        tree.unlock()
 
1408
 
1456
1409
    def test_info_stacked(self):
1457
1410
        # We have a mainline
1458
1411
        trunk_tree = self.make_branch_and_tree('mainline',
1471
1424
     stacked on: mainline
1472
1425
""", out)
1473
1426
        self.assertEqual("", err)
1474
 
 
1475
 
    def test_info_revinfo_optional(self):
1476
 
        tree = self.make_branch_and_tree('.')
1477
 
        def last_revision_info(self):
1478
 
            raise errors.UnsupportedOperation(last_revision_info, self)
1479
 
        self.overrideAttr(
1480
 
            branch.Branch, "last_revision_info", last_revision_info)
1481
 
        out, err = self.run_bzr('info -v .')
1482
 
        self.assertEqual(
1483
 
"""Standalone tree (format: 2a)
1484
 
Location:
1485
 
  branch root: .
1486
 
 
1487
 
Format:
1488
 
       control: Meta directory format 1
1489
 
  working tree: Working tree format 6
1490
 
        branch: Branch format 7
1491
 
    repository: Repository format 2a - rich roots, group compression and chk inventories
1492
 
 
1493
 
Control directory:
1494
 
         1 branches
1495
 
 
1496
 
In the working tree:
1497
 
         0 unchanged
1498
 
         0 modified
1499
 
         0 added
1500
 
         0 removed
1501
 
         0 renamed
1502
 
         0 unknown
1503
 
         0 ignored
1504
 
         0 versioned subdirectories
1505
 
""", out)
1506
 
        self.assertEqual("", err)
1507
 
 
1508
 
    def test_info_shows_colocated_branches(self):
1509
 
        bzrdir = self.make_branch('.', format='development-colo').bzrdir
1510
 
        bzrdir.create_branch(name="colo1")
1511
 
        bzrdir.create_branch(name="colo2")
1512
 
        bzrdir.create_branch(name="colo3")
1513
 
        out, err = self.run_bzr('info -v .')
1514
 
        self.assertEqualDiff(
1515
 
"""Standalone branch (format: development-colo)
1516
 
Location:
1517
 
  branch root: .
1518
 
 
1519
 
Format:
1520
 
       control: Meta directory format 1 with support for colocated branches
1521
 
        branch: Branch format 7
1522
 
    repository: Repository format 2a - rich roots, group compression and chk inventories
1523
 
 
1524
 
Control directory:
1525
 
         4 branches
1526
 
 
1527
 
Branch history:
1528
 
         0 revisions
1529
 
 
1530
 
Repository:
1531
 
         0 revisions
1532
 
""", out)
1533
 
        self.assertEqual("", err)
1534
 
 
1535
 
 
1536
 
class TestSmartServerInfo(tests.TestCaseWithTransport):
1537
 
 
1538
 
    def test_simple_branch_info(self):
1539
 
        self.setup_smart_server_with_call_log()
1540
 
        t = self.make_branch_and_tree('branch')
1541
 
        self.build_tree_contents([('branch/foo', 'thecontents')])
1542
 
        t.add("foo")
1543
 
        t.commit("message")
1544
 
        self.reset_smart_call_log()
1545
 
        out, err = self.run_bzr(['info', self.get_url('branch')])
1546
 
        # This figure represent the amount of work to perform this use case. It
1547
 
        # is entirely ok to reduce this number if a test fails due to rpc_count
1548
 
        # being too low. If rpc_count increases, more network roundtrips have
1549
 
        # become necessary for this use case. Please do not adjust this number
1550
 
        # upwards without agreement from bzr's network support maintainers.
1551
 
        self.assertLength(12, self.hpss_calls)
1552
 
        self.assertLength(1, self.hpss_connections)
1553
 
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
1554
 
 
1555
 
    def test_verbose_branch_info(self):
1556
 
        self.setup_smart_server_with_call_log()
1557
 
        t = self.make_branch_and_tree('branch')
1558
 
        self.build_tree_contents([('branch/foo', 'thecontents')])
1559
 
        t.add("foo")
1560
 
        t.commit("message")
1561
 
        self.reset_smart_call_log()
1562
 
        out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
1563
 
        # This figure represent the amount of work to perform this use case. It
1564
 
        # is entirely ok to reduce this number if a test fails due to rpc_count
1565
 
        # being too low. If rpc_count increases, more network roundtrips have
1566
 
        # become necessary for this use case. Please do not adjust this number
1567
 
        # upwards without agreement from bzr's network support maintainers.
1568
 
        self.assertLength(16, self.hpss_calls)
1569
 
        self.assertLength(1, self.hpss_connections)
1570
 
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)