~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2012 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
20
21
import sys
21
22
 
22
23
from bzrlib import (
23
24
    branch,
24
25
    bzrdir,
 
26
    controldir,
25
27
    errors,
26
28
    info,
27
29
    osutils,
29
31
    upgrade,
30
32
    urlutils,
31
33
    )
 
34
from bzrlib.tests.matchers import ContainsNoVfsCalls
32
35
from bzrlib.transport import memory
33
36
 
34
37
 
45
48
        self.assertEqual(out, '')
46
49
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
47
50
 
 
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
 
48
72
    def test_info_standalone(self):
49
73
        transport = self.get_transport()
50
74
 
51
75
        # Create initial standalone branch
52
 
        tree1 = self.make_branch_and_tree('standalone', 'weave')
 
76
        tree1 = self.make_branch_and_tree('standalone', 'knit')
53
77
        self.build_tree(['standalone/a'])
54
78
        tree1.add('a')
55
79
        branch1 = tree1.branch
56
80
 
57
81
        out, err = self.run_bzr('info standalone')
58
82
        self.assertEqualDiff(
59
 
"""Standalone tree (format: weave)
 
83
"""Standalone tree (format: knit)
60
84
Location:
61
85
  branch root: standalone
62
86
""", out)
65
89
        # Standalone branch - verbose mode
66
90
        out, err = self.run_bzr('info standalone -v')
67
91
        self.assertEqualDiff(
68
 
"""Standalone tree (format: weave)
 
92
"""Standalone tree (format: knit)
69
93
Location:
70
94
  branch root: standalone
71
95
 
72
96
Format:
73
 
       control: All-in-one format 6
74
 
  working tree: Working tree format 2
75
 
        branch: Branch format 4
76
 
    repository: Weave repository format 6
 
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
77
104
 
78
105
In the working tree:
79
106
         0 unchanged
96
123
        # Standalone branch - really verbose mode
97
124
        out, err = self.run_bzr('info standalone -vv')
98
125
        self.assertEqualDiff(
99
 
"""Standalone tree (format: weave)
 
126
"""Standalone tree (format: knit)
100
127
Location:
101
128
  branch root: standalone
102
129
 
103
130
Format:
104
 
       control: All-in-one format 6
105
 
  working tree: Working tree format 2
106
 
        branch: Branch format 4
107
 
    repository: Weave repository format 6
 
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
108
138
 
109
139
In the working tree:
110
140
         0 unchanged
125
155
""", out)
126
156
        self.assertEqual('', err)
127
157
        tree1.commit('commit one')
128
 
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
 
158
        rev = branch1.repository.get_revision(branch1.last_revision())
129
159
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
130
160
 
131
161
        # Branch standalone with push location
134
164
 
135
165
        out, err = self.run_bzr('info branch')
136
166
        self.assertEqualDiff(
137
 
"""Standalone tree (format: weave)
 
167
"""Standalone tree (format: knit)
138
168
Location:
139
169
  branch root: branch
140
170
 
146
176
 
147
177
        out, err = self.run_bzr('info branch --verbose')
148
178
        self.assertEqualDiff(
149
 
"""Standalone tree (format: weave)
 
179
"""Standalone tree (format: knit)
150
180
Location:
151
181
  branch root: branch
152
182
 
155
185
  parent branch: standalone
156
186
 
157
187
Format:
158
 
       control: All-in-one format 6
159
 
  working tree: Working tree format 2
160
 
        branch: Branch format 4
161
 
    repository: Weave repository format 6
 
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
162
195
 
163
196
In the working tree:
164
197
         1 unchanged
187
220
        branch1.bzrdir.sprout('bound')
188
221
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
189
222
        upgrade.upgrade('bound', knit1_format)
190
 
        branch3 = bzrdir.BzrDir.open('bound').open_branch()
 
223
        branch3 = controldir.ControlDir.open('bound').open_branch()
191
224
        branch3.bind(branch1)
192
225
        bound_tree = branch3.bzrdir.open_workingtree()
193
226
        out, err = self.run_bzr('info -v bound')
206
239
        branch: %s
207
240
    repository: %s
208
241
 
 
242
Control directory:
 
243
         1 branches
 
244
 
209
245
In the working tree:
210
246
         1 unchanged
211
247
         0 modified
213
249
         0 removed
214
250
         0 renamed
215
251
         0 unknown
216
 
         1 ignored
 
252
         0 ignored
217
253
         0 versioned subdirectories
218
254
 
219
255
Branch history:
232
268
        self.assertEqual('', err)
233
269
 
234
270
        # Checkout standalone (same as above, but does not have parent set)
235
 
        branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
 
271
        branch4 = controldir.ControlDir.create_branch_convenience('checkout',
236
272
            format=knit1_format)
237
273
        branch4.bind(branch1)
238
274
        branch4.bzrdir.open_workingtree().update()
249
285
        branch: Branch format 5
250
286
    repository: %s
251
287
 
 
288
Control directory:
 
289
         1 branches
 
290
 
252
291
In the working tree:
253
292
         1 unchanged
254
293
         0 modified
276
315
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
277
316
        branch5 = tree5.branch
278
317
        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"
279
322
        self.assertEqualDiff(
280
323
"""Lightweight checkout (format: %s)
281
324
Location:
284
327
 
285
328
Format:
286
329
       control: Meta directory format 1
287
 
  working tree: Working tree format 6
288
 
        branch: Branch format 4
289
 
    repository: Weave repository format 6
 
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
290
336
 
291
337
In the working tree:
292
338
         1 unchanged
306
352
 
307
353
Repository:
308
354
         1 revision
309
 
""" % (self._repo_strings, datestring_first, datestring_first,), out)
 
355
""" % (format_description, datestring_first, datestring_first,), out)
310
356
        self.assertEqual('', err)
311
357
 
312
358
        # Update initial standalone branch
313
359
        self.build_tree(['standalone/b'])
314
360
        tree1.add('b')
315
361
        tree1.commit('commit two')
316
 
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
 
362
        rev = branch1.repository.get_revision(branch1.last_revision())
317
363
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
318
364
 
319
365
        # Out of date branched standalone branch will not be detected
320
366
        out, err = self.run_bzr('info -v branch')
321
367
        self.assertEqualDiff(
322
 
"""Standalone tree (format: weave)
 
368
"""Standalone tree (format: knit)
323
369
Location:
324
370
  branch root: branch
325
371
 
328
374
  parent branch: standalone
329
375
 
330
376
Format:
331
 
       control: All-in-one format 6
332
 
  working tree: Working tree format 2
333
 
        branch: Branch format 4
334
 
    repository: Weave repository format 6
 
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
335
384
 
336
385
In the working tree:
337
386
         1 unchanged
372
421
        branch: Branch format 5
373
422
    repository: %s
374
423
 
 
424
Control directory:
 
425
         1 branches
 
426
 
375
427
Branch is out of date: missing 1 revision.
376
428
 
377
429
In the working tree:
381
433
         0 removed
382
434
         0 renamed
383
435
         0 unknown
384
 
         1 ignored
 
436
         0 ignored
385
437
         0 versioned subdirectories
386
438
 
387
439
Branch history:
411
463
        branch: Branch format 5
412
464
    repository: %s
413
465
 
 
466
Control directory:
 
467
         1 branches
 
468
 
414
469
Branch is out of date: missing 1 revision.
415
470
 
416
471
In the working tree:
446
501
 
447
502
Format:
448
503
       control: Meta directory format 1
449
 
  working tree: Working tree format 6
450
 
        branch: Branch format 4
451
 
    repository: Weave repository format 6
 
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
452
510
 
453
511
Working tree is out of date: missing 1 revision.
454
512
 
470
528
 
471
529
Repository:
472
530
         2 revisions
473
 
""" % (self._repo_strings, datestring_first, datestring_last,), out)
 
531
""" % (format_description, datestring_first, datestring_last,), out)
474
532
        self.assertEqual('', err)
475
533
 
476
534
    def test_info_standalone_no_tree(self):
489
547
        branch: %s
490
548
    repository: %s
491
549
 
 
550
Control directory:
 
551
         1 branches
 
552
 
492
553
Branch history:
493
554
         0 revisions
494
555
 
517
578
       control: Meta directory format 1
518
579
    repository: %s
519
580
 
 
581
Control directory:
 
582
         0 branches
 
583
 
520
584
Repository:
521
585
         0 revisions
522
586
""" % ('repo', format.repository_format.get_format_description(),
525
589
 
526
590
        # Create branch inside shared repository
527
591
        repo.bzrdir.root_transport.mkdir('branch')
528
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
529
 
            format=format)
 
592
        branch1 = controldir.ControlDir.create_branch_convenience(
 
593
            'repo/branch', format=format)
530
594
        out, err = self.run_bzr('info -v repo/branch')
531
595
        self.assertEqualDiff(
532
596
"""Repository branch (format: dirstate or knit)
539
603
        branch: %s
540
604
    repository: %s
541
605
 
 
606
Control directory:
 
607
         1 branches
 
608
 
542
609
Branch history:
543
610
         0 revisions
544
611
 
567
634
        self.build_tree(['tree/lightcheckout/a'])
568
635
        tree2.add('a')
569
636
        tree2.commit('commit one')
570
 
        rev = repo.get_revision(branch2.revision_history()[0])
 
637
        rev = repo.get_revision(branch2.last_revision())
571
638
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
572
639
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
573
640
        self.assertEqualDiff(
583
650
        branch: %s
584
651
    repository: %s
585
652
 
 
653
Control directory:
 
654
         1 branches
 
655
 
586
656
In the working tree:
587
657
         1 unchanged
588
658
         0 modified
621
691
        branch: %s
622
692
    repository: %s
623
693
 
 
694
Control directory:
 
695
         1 branches
 
696
 
624
697
Branch is out of date: missing 1 revision.
625
698
 
626
699
In the working tree:
660
733
        branch: %s
661
734
    repository: %s
662
735
 
 
736
Control directory:
 
737
         1 branches
 
738
 
663
739
In the working tree:
664
740
         1 unchanged
665
741
         0 modified
686
762
        tree3.commit('commit two')
687
763
 
688
764
        # Out of date lightweight checkout
689
 
        rev = repo.get_revision(branch1.revision_history()[-1])
 
765
        rev = repo.get_revision(branch1.last_revision())
690
766
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
691
767
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
692
768
        self.assertEqualDiff(
702
778
        branch: %s
703
779
    repository: %s
704
780
 
 
781
Control directory:
 
782
         1 branches
 
783
 
705
784
Working tree is out of date: missing 1 revision.
706
785
 
707
786
In the working tree:
741
820
        branch: %s
742
821
    repository: %s
743
822
 
 
823
Control directory:
 
824
         1 branches
 
825
 
744
826
Branch history:
745
827
         2 revisions
746
828
         0 days old
766
848
       control: Meta directory format 1
767
849
    repository: %s
768
850
 
 
851
Control directory:
 
852
         0 branches
 
853
 
769
854
Repository:
770
855
         2 revisions
771
856
""" % (format.repository_format.get_format_description(),
789
874
       control: Meta directory format 1
790
875
    repository: %s
791
876
 
 
877
Control directory:
 
878
         0 branches
 
879
 
792
880
Create working tree for new branches inside the repository.
793
881
 
794
882
Repository:
799
887
 
800
888
        # Create two branches
801
889
        repo.bzrdir.root_transport.mkdir('branch1')
802
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
 
890
        branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
803
891
            format=format)
804
892
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
805
893
 
817
905
        branch: %s
818
906
    repository: %s
819
907
 
 
908
Control directory:
 
909
         1 branches
 
910
 
820
911
In the working tree:
821
912
         0 unchanged
822
913
         0 modified
842
933
        tree1 = branch1.bzrdir.open_workingtree()
843
934
        tree1.add('a')
844
935
        tree1.commit('commit one')
845
 
        rev = repo.get_revision(branch1.revision_history()[0])
 
936
        rev = repo.get_revision(branch1.last_revision())
846
937
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
847
938
        out, err = self.run_bzr('info -v repo/branch1')
848
939
        self.assertEqualDiff(
857
948
        branch: %s
858
949
    repository: %s
859
950
 
 
951
Control directory:
 
952
         1 branches
 
953
 
860
954
In the working tree:
861
955
         1 unchanged
862
956
         0 modified
898
992
        branch: %s
899
993
    repository: %s
900
994
 
 
995
Control directory:
 
996
         1 branches
 
997
 
901
998
In the working tree:
902
999
         0 unchanged
903
1000
         0 modified
937
1034
        branch: %s
938
1035
    repository: %s
939
1036
 
 
1037
Control directory:
 
1038
         1 branches
 
1039
 
940
1040
In the working tree:
941
1041
         1 unchanged
942
1042
         0 modified
972
1072
       control: Meta directory format 1
973
1073
    repository: %s
974
1074
 
 
1075
Control directory:
 
1076
         0 branches
 
1077
 
975
1078
Create working tree for new branches inside the repository.
976
1079
 
977
1080
Repository:
998
1101
       control: Meta directory format 1
999
1102
    repository: %s
1000
1103
 
 
1104
Control directory:
 
1105
         0 branches
 
1106
 
1001
1107
Create working tree for new branches inside the repository.
1002
1108
 
1003
1109
Repository:
1023
1129
        branch: %s
1024
1130
    repository: %s
1025
1131
 
 
1132
Control directory:
 
1133
         1 branches
 
1134
 
1026
1135
In the working tree:
1027
1136
         0 unchanged
1028
1137
         0 modified
1060
1169
       control: Meta directory format 1
1061
1170
    repository: %s
1062
1171
 
 
1172
Control directory:
 
1173
         0 branches
 
1174
 
1063
1175
Create working tree for new branches inside the repository.
1064
1176
 
1065
1177
Repository:
1069
1181
       ), out)
1070
1182
        self.assertEqual('', err)
1071
1183
 
 
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
 
1072
1200
    def assertCheckoutStatusOutput(self,
1073
1201
        command_string, lco_tree, shared_repo=None,
1074
1202
        repo_branch=None,
1183
1311
        branch: %s
1184
1312
    repository: %s
1185
1313
%s
 
1314
Control directory:
 
1315
         1 branches
 
1316
 
1186
1317
In the working tree:
1187
1318
         0 unchanged
1188
1319
         0 modified
1217
1348
                                    format=bzrdir.BzrDirMetaFormat1())
1218
1349
        repo.set_make_working_trees(False)
1219
1350
        repo.bzrdir.root_transport.mkdir('branch')
1220
 
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1351
        repo_branch = controldir.ControlDir.create_branch_convenience(
 
1352
            'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1222
1353
        # Do a heavy checkout
1223
1354
        transport.mkdir('tree')
1224
1355
        transport.mkdir('tree/checkout')
1225
 
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
 
            format=bzrdir.BzrDirMetaFormat1())
 
1356
        co_branch = controldir.ControlDir.create_branch_convenience(
 
1357
            'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1227
1358
        co_branch.bind(repo_branch)
1228
1359
        # Do a light checkout of the heavy one
1229
1360
        transport.mkdir('tree/lightcheckout')
1230
1361
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
 
        branch.BranchReferenceFormat().initialize(lco_dir,
1232
 
            target_branch=co_branch)
 
1362
        lco_dir.set_branch_reference(co_branch)
1233
1363
        lco_dir.create_workingtree()
1234
1364
        lco_tree = lco_dir.open_workingtree()
1235
1365
 
1323
1453
            self.knownFailure('Win32 cannot run "bzr info"'
1324
1454
                              ' when the tree is locked.')
1325
1455
 
1326
 
    def test_info_locking_oslocks(self):
1327
 
        if sys.platform == "win32":
1328
 
            self.skip("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
 
 
1409
1456
    def test_info_stacked(self):
1410
1457
        # We have a mainline
1411
1458
        trunk_tree = self.make_branch_and_tree('mainline',
1424
1471
     stacked on: mainline
1425
1472
""", out)
1426
1473
        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(10, 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(14, self.hpss_calls)
 
1569
        self.assertLength(1, self.hpss_connections)
 
1570
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)