/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2019-05-29 03:22:34 UTC
  • mfrom: (7303 work)
  • mto: This revision was merged to the branch mainline in revision 7306.
  • Revision ID: jelmer@jelmer.uk-20190529032234-mt3fuws8gq03tapi
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    def test_info_non_existing(self):
47
47
        self.vfs_transport_factory = memory.MemoryServer
48
48
        location = self.get_url()
49
 
        out, err = self.run_bzr('info '+location, retcode=3)
 
49
        out, err = self.run_bzr('info ' + location, retcode=3)
50
50
        self.assertEqual(out, '')
51
51
        self.assertEqual(err, 'brz: ERROR: Not a branch: "%s".\n' % location)
52
52
 
54
54
        self.make_controldir('ctrl')
55
55
        out, err = self.run_bzr('info ctrl')
56
56
        self.assertEqual(out,
57
 
            'Empty control directory (format: 2a)\n'
58
 
            'Location:\n'
59
 
            '  control directory: ctrl\n')
 
57
                         'Empty control directory (format: 2a)\n'
 
58
                         'Location:\n'
 
59
                         '  control directory: ctrl\n')
60
60
        self.assertEqual(err, '')
61
61
 
62
62
    def test_info_empty_controldir_verbose(self):
63
63
        self.make_controldir('ctrl')
64
64
        out, err = self.run_bzr('info -v ctrl')
65
65
        self.assertEqualDiff(out,
66
 
            'Empty control directory (format: 2a)\n'
67
 
            'Location:\n'
68
 
            '  control directory: ctrl\n\n'
69
 
            'Format:\n'
70
 
            '       control: Meta directory format 1\n\n'
71
 
            'Control directory:\n'
72
 
            '         0 branches\n')
 
66
                             'Empty control directory (format: 2a)\n'
 
67
                             'Location:\n'
 
68
                             '  control directory: ctrl\n\n'
 
69
                             'Format:\n'
 
70
                             '       control: Meta directory format 1\n\n'
 
71
                             'Control directory:\n'
 
72
                             '         0 branches\n')
73
73
        self.assertEqual(err, '')
74
74
 
75
75
    def test_info_dangling_branch_reference(self):
78
78
        shutil.rmtree('target')
79
79
        out, err = self.run_bzr('info from')
80
80
        self.assertEqual(out,
81
 
            'Dangling branch reference (format: 2a)\n'
82
 
            'Location:\n'
83
 
            '   control directory: from\n'
84
 
            '  checkout of branch: target\n')
 
81
                         'Dangling branch reference (format: 2a)\n'
 
82
                         'Location:\n'
 
83
                         '   control directory: from\n'
 
84
                         '  checkout of branch: target\n')
 
85
        self.assertEqual(err, '')
 
86
 
 
87
    def test_info_colocated(self):
 
88
        br = self.make_branch_and_tree('target', format='development-colo')
 
89
        target = br.controldir.create_branch(name='dichtbij')
 
90
        br.controldir.set_branch_reference(target)
 
91
        out, err = self.run_bzr('info target')
 
92
        self.assertEqual(out,
 
93
                         'Standalone tree (format: development-colo)\n'
 
94
                         'Location:\n'
 
95
                         '            light checkout root: target\n'
 
96
                         '  checkout of co-located branch: dichtbij\n')
85
97
        self.assertEqual(err, '')
86
98
 
87
99
    def test_info_standalone(self):
95
107
 
96
108
        out, err = self.run_bzr('info standalone')
97
109
        self.assertEqualDiff(
98
 
"""Standalone tree (format: knit)
 
110
            """Standalone tree (format: knit)
99
111
Location:
100
112
  branch root: standalone
101
113
""", out)
104
116
        # Standalone branch - verbose mode
105
117
        out, err = self.run_bzr('info standalone -v')
106
118
        self.assertEqualDiff(
107
 
"""Standalone tree (format: knit)
 
119
            """Standalone tree (format: knit)
108
120
Location:
109
121
  branch root: standalone
110
122
 
138
150
        # Standalone branch - really verbose mode
139
151
        out, err = self.run_bzr('info standalone -vv')
140
152
        self.assertEqualDiff(
141
 
"""Standalone tree (format: knit)
 
153
            """Standalone tree (format: knit)
142
154
Location:
143
155
  branch root: standalone
144
156
 
179
191
 
180
192
        out, err = self.run_bzr('info branch')
181
193
        self.assertEqualDiff(
182
 
"""Standalone tree (format: knit)
 
194
            """Standalone tree (format: knit)
183
195
Location:
184
196
  branch root: branch
185
197
 
191
203
 
192
204
        out, err = self.run_bzr('info branch --verbose')
193
205
        self.assertEqualDiff(
194
 
"""Standalone tree (format: knit)
 
206
            """Standalone tree (format: knit)
195
207
Location:
196
208
  branch root: branch
197
209
 
240
252
        bound_tree = branch3.controldir.open_workingtree()
241
253
        out, err = self.run_bzr('info -v bound')
242
254
        self.assertEqualDiff(
243
 
"""Checkout (format: knit)
 
255
            """Checkout (format: knit)
244
256
Location:
245
257
       checkout root: bound
246
258
  checkout of branch: standalone
276
288
Repository:
277
289
         1 revision
278
290
""" % (bound_tree._format.get_format_description(),
279
 
       branch3._format.get_format_description(),
280
 
       branch3.repository._format.get_format_description(),
281
 
       datestring_first, datestring_first,
 
291
                branch3._format.get_format_description(),
 
292
                branch3.repository._format.get_format_description(),
 
293
                datestring_first, datestring_first,
282
294
       ), out)
283
295
        self.assertEqual('', err)
284
296
 
285
297
        # Checkout standalone (same as above, but does not have parent set)
286
298
        branch4 = controldir.ControlDir.create_branch_convenience('checkout',
287
 
            format=knit1_format)
 
299
                                                                  format=knit1_format)
288
300
        branch4.bind(branch1)
289
301
        branch4.controldir.open_workingtree().update()
290
302
        out, err = self.run_bzr('info checkout --verbose')
291
303
        self.assertEqualDiff(
292
 
"""Checkout (format: knit)
 
304
            """Checkout (format: knit)
293
305
Location:
294
306
       checkout root: checkout
295
307
  checkout of branch: standalone
322
334
Repository:
323
335
         1 revision
324
336
""" % (branch4.repository._format.get_format_description(),
325
 
       datestring_first, datestring_first,
 
337
                datestring_first, datestring_first,
326
338
       ), out)
327
339
        self.assertEqual('', err)
328
340
 
335
347
        else:
336
348
            format_description = "knit"
337
349
        self.assertEqualDiff(
338
 
"""Lightweight checkout (format: %s)
 
350
            """Lightweight checkout (format: %s)
339
351
Location:
340
352
  light checkout root: lightcheckout
341
353
   checkout of branch: standalone
380
392
        # Out of date branched standalone branch will not be detected
381
393
        out, err = self.run_bzr('info -v branch')
382
394
        self.assertEqualDiff(
383
 
"""Standalone tree (format: knit)
 
395
            """Standalone tree (format: knit)
384
396
Location:
385
397
  branch root: branch
386
398
 
422
434
        # Out of date bound branch
423
435
        out, err = self.run_bzr('info -v bound')
424
436
        self.assertEqualDiff(
425
 
"""Checkout (format: knit)
 
437
            """Checkout (format: knit)
426
438
Location:
427
439
       checkout root: bound
428
440
  checkout of branch: standalone
460
472
Repository:
461
473
         1 revision
462
474
""" % (branch3.repository._format.get_format_description(),
463
 
       datestring_first, datestring_first,
 
475
                datestring_first, datestring_first,
464
476
       ), out)
465
477
        self.assertEqual('', err)
466
478
 
467
479
        # Out of date checkout
468
480
        out, err = self.run_bzr('info -v checkout')
469
481
        self.assertEqualDiff(
470
 
"""Checkout (format: knit)
 
482
            """Checkout (format: knit)
471
483
Location:
472
484
       checkout root: checkout
473
485
  checkout of branch: standalone
502
514
Repository:
503
515
         1 revision
504
516
""" % (branch4.repository._format.get_format_description(),
505
 
       datestring_first, datestring_first,
 
517
                datestring_first, datestring_first,
506
518
       ), out)
507
519
        self.assertEqual('', err)
508
520
 
509
521
        # Out of date lightweight checkout
510
522
        out, err = self.run_bzr('info lightcheckout --verbose')
511
523
        self.assertEqualDiff(
512
 
"""Lightweight checkout (format: %s)
 
524
            """Lightweight checkout (format: %s)
513
525
Location:
514
526
  light checkout root: lightcheckout
515
527
   checkout of branch: standalone
553
565
        repo = branch.repository
554
566
        out, err = self.run_bzr('info branch -v')
555
567
        self.assertEqualDiff(
556
 
"""Standalone branch (format: %s)
 
568
            """Standalone branch (format: %s)
557
569
Location:
558
570
  branch root: branch
559
571
 
571
583
Repository:
572
584
         0 revisions
573
585
""" % (info.describe_format(repo.controldir, repo, branch, None),
574
 
       format.get_branch_format().get_format_description(),
575
 
       format.repository_format.get_format_description(),
 
586
                format.get_branch_format().get_format_description(),
 
587
                format.repository_format.get_format_description(),
576
588
       ), out)
577
589
        self.assertEqual('', err)
578
590
 
585
597
        repo.set_make_working_trees(False)
586
598
        out, err = self.run_bzr('info -v repo')
587
599
        self.assertEqualDiff(
588
 
"""Shared repository (format: dirstate or dirstate-tags or knit)
 
600
            """Shared repository (format: dirstate or dirstate-tags or knit)
589
601
Location:
590
602
  shared repository: %s
591
603
 
608
620
            'repo/branch', format=format)
609
621
        out, err = self.run_bzr('info -v repo/branch')
610
622
        self.assertEqualDiff(
611
 
"""Repository branch (format: dirstate or knit)
 
623
            """Repository branch (format: dirstate or knit)
612
624
Location:
613
625
  shared repository: repo
614
626
  repository branch: repo/branch
627
639
Repository:
628
640
         0 revisions
629
641
""" % (format.get_branch_format().get_format_description(),
630
 
       format.repository_format.get_format_description(),
 
642
                format.repository_format.get_format_description(),
631
643
       ), out)
632
644
        self.assertEqual('', err)
633
645
 
635
647
        transport.mkdir('tree')
636
648
        transport.mkdir('tree/lightcheckout')
637
649
        tree2 = branch1.create_checkout('tree/lightcheckout',
638
 
            lightweight=True)
 
650
                                        lightweight=True)
639
651
        branch2 = tree2.branch
640
652
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
641
 
                   shared_repo=repo, repo_branch=branch1, verbose=True)
 
653
                                        shared_repo=repo, repo_branch=branch1, verbose=True)
642
654
 
643
655
        # Create normal checkout
644
656
        tree3 = branch1.create_checkout('tree/checkout')
645
657
        self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
646
 
            verbose=True,
647
 
            light_checkout=False, repo_branch=branch1)
 
658
                                        verbose=True,
 
659
                                        light_checkout=False, repo_branch=branch1)
648
660
        # Update lightweight checkout
649
661
        self.build_tree(['tree/lightcheckout/a'])
650
662
        tree2.add('a')
653
665
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
654
666
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
655
667
        self.assertEqualDiff(
656
 
"""Lightweight checkout (format: %s)
 
668
            """Lightweight checkout (format: %s)
657
669
Location:
658
670
  light checkout root: tree/lightcheckout
659
671
   checkout of branch: repo/branch
687
699
Repository:
688
700
         1 revision
689
701
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
690
 
       format.repository_format.get_format_description(),
691
 
       datestring_first, datestring_first,
 
702
                format.repository_format.get_format_description(),
 
703
                datestring_first, datestring_first,
692
704
       ), out)
693
705
        self.assertEqual('', err)
694
706
 
695
707
        # Out of date checkout
696
708
        out, err = self.run_bzr('info -v tree/checkout')
697
709
        self.assertEqualDiff(
698
 
"""Checkout (format: unnamed)
 
710
            """Checkout (format: unnamed)
699
711
Location:
700
712
       checkout root: tree/checkout
701
713
  checkout of branch: repo/branch
727
739
Repository:
728
740
         0 revisions
729
741
""" % (format.get_branch_format().get_format_description(),
730
 
       format.repository_format.get_format_description(),
 
742
                format.repository_format.get_format_description(),
731
743
       ), out)
732
744
        self.assertEqual('', err)
733
745
 
737
749
        tree3.add('b')
738
750
        out, err = self.run_bzr('info tree/checkout --verbose')
739
751
        self.assertEqualDiff(
740
 
"""Checkout (format: unnamed)
 
752
            """Checkout (format: unnamed)
741
753
Location:
742
754
       checkout root: tree/checkout
743
755
  checkout of branch: repo/branch
770
782
Repository:
771
783
         1 revision
772
784
""" % (format.get_branch_format().get_format_description(),
773
 
       format.repository_format.get_format_description(),
774
 
       datestring_first, datestring_first,
 
785
                format.repository_format.get_format_description(),
 
786
                datestring_first, datestring_first,
775
787
       ), out)
776
788
        self.assertEqual('', err)
777
789
        tree3.commit('commit two')
781
793
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
782
794
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
783
795
        self.assertEqualDiff(
784
 
"""Lightweight checkout (format: %s)
 
796
            """Lightweight checkout (format: %s)
785
797
Location:
786
798
  light checkout root: tree/lightcheckout
787
799
   checkout of branch: repo/branch
817
829
Repository:
818
830
         2 revisions
819
831
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
820
 
       format.repository_format.get_format_description(),
821
 
       datestring_first, datestring_last,
 
832
                format.repository_format.get_format_description(),
 
833
                datestring_first, datestring_last,
822
834
       ), out)
823
835
        self.assertEqual('', err)
824
836
 
825
837
        # Show info about shared branch
826
838
        out, err = self.run_bzr('info repo/branch --verbose')
827
839
        self.assertEqualDiff(
828
 
"""Repository branch (format: dirstate or knit)
 
840
            """Repository branch (format: dirstate or knit)
829
841
Location:
830
842
  shared repository: repo
831
843
  repository branch: repo/branch
847
859
Repository:
848
860
         2 revisions
849
861
""" % (format.get_branch_format().get_format_description(),
850
 
       format.repository_format.get_format_description(),
851
 
       datestring_first, datestring_last,
 
862
                format.repository_format.get_format_description(),
 
863
                datestring_first, datestring_last,
852
864
       ), out)
853
865
        self.assertEqual('', err)
854
866
 
855
867
        # Show info about repository with revisions
856
868
        out, err = self.run_bzr('info -v repo')
857
869
        self.assertEqualDiff(
858
 
"""Shared repository (format: dirstate or dirstate-tags or knit)
 
870
            """Shared repository (format: dirstate or dirstate-tags or knit)
859
871
Location:
860
872
  shared repository: repo
861
873
 
881
893
        repo.set_make_working_trees(True)
882
894
        out, err = self.run_bzr('info -v repo')
883
895
        self.assertEqualDiff(
884
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
896
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
885
897
Location:
886
898
  shared repository: repo
887
899
 
903
915
        # Create two branches
904
916
        repo.controldir.root_transport.mkdir('branch1')
905
917
        branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
906
 
            format=format)
 
918
                                                                  format=format)
907
919
        branch2 = branch1.controldir.sprout('repo/branch2').open_branch()
908
920
 
909
921
        # Empty first branch
910
922
        out, err = self.run_bzr('info repo/branch1 --verbose')
911
923
        self.assertEqualDiff(
912
 
"""Repository tree (format: knit)
 
924
            """Repository tree (format: knit)
913
925
Location:
914
926
  shared repository: repo
915
927
  repository branch: repo/branch1
939
951
Repository:
940
952
         0 revisions
941
953
""" % (format.get_branch_format().get_format_description(),
942
 
       format.repository_format.get_format_description(),
 
954
                format.repository_format.get_format_description(),
943
955
       ), out)
944
956
        self.assertEqual('', err)
945
957
 
952
964
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
953
965
        out, err = self.run_bzr('info -v repo/branch1')
954
966
        self.assertEqualDiff(
955
 
"""Repository tree (format: knit)
 
967
            """Repository tree (format: knit)
956
968
Location:
957
969
  shared repository: repo
958
970
  repository branch: repo/branch1
985
997
Repository:
986
998
         1 revision
987
999
""" % (format.get_branch_format().get_format_description(),
988
 
       format.repository_format.get_format_description(),
989
 
       datestring_first, datestring_first,
 
1000
                format.repository_format.get_format_description(),
 
1001
                datestring_first, datestring_first,
990
1002
       ), out)
991
1003
        self.assertEqual('', err)
992
1004
 
993
1005
        # Out of date second branch
994
1006
        out, err = self.run_bzr('info repo/branch2 --verbose')
995
1007
        self.assertEqualDiff(
996
 
"""Repository tree (format: knit)
 
1008
            """Repository tree (format: knit)
997
1009
Location:
998
1010
  shared repository: repo
999
1011
  repository branch: repo/branch2
1026
1038
Repository:
1027
1039
         1 revision
1028
1040
""" % (format.get_branch_format().get_format_description(),
1029
 
       format.repository_format.get_format_description(),
 
1041
                format.repository_format.get_format_description(),
1030
1042
       ), out)
1031
1043
        self.assertEqual('', err)
1032
1044
 
1035
1047
        tree2.pull(branch1)
1036
1048
        out, err = self.run_bzr('info -v repo/branch2')
1037
1049
        self.assertEqualDiff(
1038
 
"""Repository tree (format: knit)
 
1050
            """Repository tree (format: knit)
1039
1051
Location:
1040
1052
  shared repository: repo
1041
1053
  repository branch: repo/branch2
1071
1083
Repository:
1072
1084
         1 revision
1073
1085
""" % (format.get_branch_format().get_format_description(),
1074
 
       format.repository_format.get_format_description(),
1075
 
       datestring_first, datestring_first,
 
1086
                format.repository_format.get_format_description(),
 
1087
                datestring_first, datestring_first,
1076
1088
       ), out)
1077
1089
        self.assertEqual('', err)
1078
1090
 
1079
1091
        # Show info about repository with revisions
1080
1092
        out, err = self.run_bzr('info -v repo')
1081
1093
        self.assertEqualDiff(
1082
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
1094
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
1083
1095
Location:
1084
1096
  shared repository: repo
1085
1097
 
1096
1108
         1 revision
1097
1109
""" % (format.repository_format.get_format_description(),
1098
1110
       ),
1099
 
       out)
 
1111
            out)
1100
1112
        self.assertEqual('', err)
1101
1113
 
1102
1114
    def test_info_shared_repository_with_tree_in_root(self):
1108
1120
        repo.set_make_working_trees(True)
1109
1121
        out, err = self.run_bzr('info -v repo')
1110
1122
        self.assertEqualDiff(
1111
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
1123
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
1112
1124
Location:
1113
1125
  shared repository: repo
1114
1126
 
1133
1145
        control.create_workingtree()
1134
1146
        out, err = self.run_bzr('info -v repo')
1135
1147
        self.assertEqualDiff(
1136
 
"""Repository tree (format: knit)
 
1148
            """Repository tree (format: knit)
1137
1149
Location:
1138
1150
  shared repository: repo
1139
1151
  repository branch: repo
1163
1175
Repository:
1164
1176
         0 revisions
1165
1177
""" % (format.get_branch_format().get_format_description(),
1166
 
       format.repository_format.get_format_description(),
 
1178
                format.repository_format.get_format_description(),
1167
1179
       ), out)
1168
1180
        self.assertEqual('', err)
1169
1181
 
1170
1182
    def test_info_repository_hook(self):
1171
1183
        format = controldir.format_registry.make_controldir('knit')
 
1184
 
1172
1185
        def repo_info(repo, stats, outf):
1173
1186
            outf.write(u"more info\n")
1174
1187
        info.hooks.install_named_hook('repository', repo_info, None)
1176
1189
        repo = self.make_repository('repo', shared=True, format=format)
1177
1190
        out, err = self.run_bzr('info -v repo')
1178
1191
        self.assertEqualDiff(
1179
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
1192
            """Shared repository with trees (format: dirstate or dirstate-tags or knit)
1180
1193
Location:
1181
1194
  shared repository: repo
1182
1195
 
1206
1219
        repo.controldir.create_branch(name='foo')
1207
1220
        out, err = self.run_bzr('info repo')
1208
1221
        self.assertEqualDiff(
1209
 
"""Unshared repository with trees and colocated branches (format: development-colo)
 
1222
            """Unshared repository with trees and colocated branches (format: development-colo)
1210
1223
Location:
1211
1224
  repository: repo
1212
1225
""", out)
1213
1226
        self.assertEqual('', err)
1214
1227
 
1215
1228
    def assertCheckoutStatusOutput(self,
1216
 
        command_string, lco_tree, shared_repo=None,
1217
 
        repo_branch=None,
1218
 
        tree_locked=False,
1219
 
        branch_locked=False, repo_locked=False,
1220
 
        verbose=False,
1221
 
        light_checkout=True,
1222
 
        checkout_root=None):
 
1229
                                   command_string, lco_tree, shared_repo=None,
 
1230
                                   repo_branch=None,
 
1231
                                   tree_locked=False,
 
1232
                                   branch_locked=False, repo_locked=False,
 
1233
                                   verbose=False,
 
1234
                                   light_checkout=True,
 
1235
                                   checkout_root=None):
1223
1236
        """Check the output of info in a checkout.
1224
1237
 
1225
1238
        This is not quite a mirror of the info code: rather than using the
1256
1269
            # in the different process -- either on win32 or on linux).
1257
1270
            # This should be removed when the locking errors are fixed.
1258
1271
            self.expectFailure('OS locks are exclusive '
1259
 
                'for different processes (Bug #174055)',
1260
 
                self.run_bzr_subprocess,
1261
 
                'info ' + command_string)
 
1272
                               'for different processes (Bug #174055)',
 
1273
                               self.run_bzr_subprocess,
 
1274
                               'info ' + command_string)
1262
1275
        out, err = self.run_bzr('info %s' % command_string)
1263
1276
        description = {
1264
1277
            (True, True): 'Lightweight checkout',
1291
1304
        extra_space = ''
1292
1305
        if light_checkout:
1293
1306
            tree_data = ("  light checkout root: %s\n" %
1294
 
                friendly_location(lco_tree.controldir.root_transport.base))
 
1307
                         friendly_location(lco_tree.controldir.root_transport.base))
1295
1308
            extra_space = ' '
1296
1309
        if lco_tree.branch.get_bound_location() is not None:
1297
1310
            tree_data += ("%s       checkout root: %s\n" % (extra_space,
1298
 
                friendly_location(lco_tree.branch.controldir.root_transport.base)))
 
1311
                                                            friendly_location(lco_tree.branch.controldir.root_transport.base)))
1299
1312
        if shared_repo is not None:
1300
1313
            branch_data = (
1301
1314
                "   checkout of branch: %s\n"
1309
1322
                 friendly_location(repo_branch.controldir.root_transport.base)))
1310
1323
        else:
1311
1324
            branch_data = ("   checkout of branch: %s\n" %
1312
 
                lco_tree.branch.controldir.root_transport.base)
 
1325
                           lco_tree.branch.controldir.root_transport.base)
1313
1326
 
1314
1327
        if verbose >= 2:
1315
1328
            verbose_info = '         0 committers\n'
1317
1330
            verbose_info = ''
1318
1331
 
1319
1332
        self.assertEqualDiff(
1320
 
"""%s (format: %s)
 
1333
            """%s (format: %s)
1321
1334
Location:
1322
1335
%s%s
1323
1336
Format:
1344
1357
%s
1345
1358
Repository:
1346
1359
         0 revisions
1347
 
""" %  (description,
1348
 
        format,
1349
 
        tree_data,
1350
 
        branch_data,
1351
 
        lco_tree._format.get_format_description(),
1352
 
        lco_tree.branch._format.get_format_description(),
1353
 
        lco_tree.branch.repository._format.get_format_description(),
1354
 
        expected_lock_output,
1355
 
        verbose_info,
1356
 
        ), out)
 
1360
""" % (description,
 
1361
                format,
 
1362
                tree_data,
 
1363
                branch_data,
 
1364
                lco_tree._format.get_format_description(),
 
1365
                lco_tree.branch._format.get_format_description(),
 
1366
                lco_tree.branch.repository._format.get_format_description(),
 
1367
                expected_lock_output,
 
1368
                verbose_info,
 
1369
       ), out)
1357
1370
        self.assertEqual('', err)
1358
1371
 
1359
1372
    def test_info_locking(self):
1389
1402
        lco_tree.branch.repository.lock_write()
1390
1403
        try:
1391
1404
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1392
 
            lco_tree, repo_branch=repo_branch,
1393
 
            repo_locked=True, verbose=True, light_checkout=True)
 
1405
                                            lco_tree, repo_branch=repo_branch,
 
1406
                                            repo_locked=True, verbose=True, light_checkout=True)
1394
1407
        finally:
1395
1408
            lco_tree.branch.repository.unlock()
1396
1409
        # U L L
1397
1410
        lco_tree.branch.lock_write()
1398
1411
        try:
1399
1412
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1400
 
            lco_tree,
1401
 
            branch_locked=True,
1402
 
            repo_locked=True,
1403
 
            repo_branch=repo_branch,
1404
 
            verbose=True)
 
1413
                                            lco_tree,
 
1414
                                            branch_locked=True,
 
1415
                                            repo_locked=True,
 
1416
                                            repo_branch=repo_branch,
 
1417
                                            verbose=True)
1405
1418
        finally:
1406
1419
            lco_tree.branch.unlock()
1407
1420
        # L L L
1408
1421
        lco_tree.lock_write()
1409
1422
        try:
1410
1423
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1411
 
            lco_tree, repo_branch=repo_branch,
1412
 
            tree_locked=True,
1413
 
            branch_locked=True,
1414
 
            repo_locked=True,
1415
 
            verbose=True)
 
1424
                                            lco_tree, repo_branch=repo_branch,
 
1425
                                            tree_locked=True,
 
1426
                                            branch_locked=True,
 
1427
                                            repo_locked=True,
 
1428
                                            verbose=True)
1416
1429
        finally:
1417
1430
            lco_tree.unlock()
1418
1431
        # L L U
1420
1433
        lco_tree.branch.repository.unlock()
1421
1434
        try:
1422
1435
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1423
 
            lco_tree, repo_branch=repo_branch,
1424
 
            tree_locked=True,
1425
 
            branch_locked=True,
1426
 
            verbose=True)
 
1436
                                            lco_tree, repo_branch=repo_branch,
 
1437
                                            tree_locked=True,
 
1438
                                            branch_locked=True,
 
1439
                                            verbose=True)
1427
1440
        finally:
1428
1441
            lco_tree.branch.repository.lock_write()
1429
1442
            lco_tree.unlock()
1432
1445
        lco_tree.branch.unlock()
1433
1446
        try:
1434
1447
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1435
 
            lco_tree, repo_branch=repo_branch,
1436
 
            tree_locked=True,
1437
 
            verbose=True)
 
1448
                                            lco_tree, repo_branch=repo_branch,
 
1449
                                            tree_locked=True,
 
1450
                                            verbose=True)
1438
1451
        finally:
1439
1452
            lco_tree.branch.lock_write()
1440
1453
            lco_tree.unlock()
1444
1457
        lco_tree.branch.repository.lock_write()
1445
1458
        try:
1446
1459
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1447
 
            lco_tree, repo_branch=repo_branch,
1448
 
            tree_locked=True,
1449
 
            repo_locked=True,
1450
 
            verbose=True)
 
1460
                                            lco_tree, repo_branch=repo_branch,
 
1461
                                            tree_locked=True,
 
1462
                                            repo_locked=True,
 
1463
                                            verbose=True)
1451
1464
        finally:
1452
1465
            lco_tree.branch.repository.unlock()
1453
1466
            lco_tree.branch.lock_write()
1457
1470
        lco_tree.branch.repository.unlock()
1458
1471
        try:
1459
1472
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1460
 
            lco_tree, repo_branch=repo_branch,
1461
 
            branch_locked=True,
1462
 
            verbose=True)
 
1473
                                            lco_tree, repo_branch=repo_branch,
 
1474
                                            branch_locked=True,
 
1475
                                            verbose=True)
1463
1476
        finally:
1464
1477
            lco_tree.branch.repository.lock_write()
1465
1478
            lco_tree.branch.unlock()
1471
1484
    def test_info_stacked(self):
1472
1485
        # We have a mainline
1473
1486
        trunk_tree = self.make_branch_and_tree('mainline',
1474
 
            format='1.6')
 
1487
                                               format='1.6')
1475
1488
        trunk_tree.commit('mainline')
1476
1489
        # and a branch from it which is stacked
1477
1490
        new_dir = trunk_tree.controldir.sprout('newbranch', stacked=True)
1478
1491
        out, err = self.run_bzr('info newbranch')
1479
1492
        self.assertEqual(
1480
 
"""Standalone tree (format: 1.6)
 
1493
            """Standalone tree (format: 1.6)
1481
1494
Location:
1482
1495
  branch root: newbranch
1483
1496
 
1489
1502
 
1490
1503
    def test_info_revinfo_optional(self):
1491
1504
        tree = self.make_branch_and_tree('.')
 
1505
 
1492
1506
        def last_revision_info(self):
1493
1507
            raise errors.UnsupportedOperation(last_revision_info, self)
1494
1508
        self.overrideAttr(
1495
1509
            branch.Branch, "last_revision_info", last_revision_info)
1496
1510
        out, err = self.run_bzr('info -v .')
1497
1511
        self.assertEqual(
1498
 
"""Standalone tree (format: 2a)
 
1512
            """Standalone tree (format: 2a)
1499
1513
Location:
1500
1514
  branch root: .
1501
1515
 
1527
1541
        bzrdir.create_branch(name="colo3")
1528
1542
        out, err = self.run_bzr('info -v .')
1529
1543
        self.assertEqualDiff(
1530
 
"""Standalone branch (format: development-colo)
 
1544
            """Standalone branch (format: development-colo)
1531
1545
Location:
1532
1546
  branch root: .
1533
1547