~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Author(s): Mark Hammond
  • Date: 2008-09-09 17:02:21 UTC
  • mto: This revision was merged to the branch mainline in revision 3697.
  • Revision ID: john@arbash-meinel.com-20080909170221-svim3jw2mrz0amp3
An updated transparent icon for bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007, 2008 Canonical Ltd
 
1
# Copyright (C) 2006, 2007 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
18
"""Tests for the info command of bzr."""
61
61
""", out)
62
62
        self.assertEqual('', err)
63
63
 
64
 
        # Standalone branch - verbose mode
65
64
        out, err = self.run_bzr('info standalone -v')
66
65
        self.assertEqualDiff(
67
66
"""Standalone tree (format: weave)
86
85
 
87
86
Branch history:
88
87
         0 revisions
89
 
 
90
 
Repository:
91
 
         0 revisions
92
 
""", out)
93
 
        self.assertEqual('', err)
94
 
 
95
 
        # Standalone branch - really verbose mode
96
 
        out, err = self.run_bzr('info standalone -vv')
97
 
        self.assertEqualDiff(
98
 
"""Standalone tree (format: weave)
99
 
Location:
100
 
  branch root: standalone
101
 
 
102
 
Format:
103
 
       control: All-in-one format 6
104
 
  working tree: Working tree format 2
105
 
        branch: Branch format 4
106
 
    repository: Weave repository format 6
107
 
 
108
 
In the working tree:
109
 
         0 unchanged
110
 
         0 modified
111
 
         1 added
112
 
         0 removed
113
 
         0 renamed
114
 
         0 unknown
115
 
         0 ignored
116
 
         0 versioned subdirectories
117
 
 
118
 
Branch history:
119
 
         0 revisions
120
88
         0 committers
121
89
 
122
90
Repository:
171
139
 
172
140
Branch history:
173
141
         1 revision
 
142
         1 committer
174
143
         0 days old
175
144
   first revision: %s
176
145
  latest revision: %s
217
186
 
218
187
Branch history:
219
188
         1 revision
 
189
         1 committer
220
190
         0 days old
221
191
   first revision: %s
222
192
  latest revision: %s
260
230
 
261
231
Branch history:
262
232
         1 revision
 
233
         1 committer
263
234
         0 days old
264
235
   first revision: %s
265
236
  latest revision: %s
277
248
        out, err = self.run_bzr('info -v lightcheckout')
278
249
        self.assertEqualDiff(
279
250
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root \
280
 
or 1.9 or 1.9-rich-root \
281
251
or dirstate or dirstate-tags or \
282
252
pack-0.92 or rich-root or rich-root-pack)
283
253
Location:
302
272
 
303
273
Branch history:
304
274
         1 revision
 
275
         1 committer
305
276
         0 days old
306
277
   first revision: %s
307
278
  latest revision: %s
347
318
 
348
319
Branch history:
349
320
         1 revision
 
321
         1 committer
350
322
         0 days old
351
323
   first revision: %s
352
324
  latest revision: %s
388
360
 
389
361
Branch history:
390
362
         1 revision
 
363
         1 committer
391
364
         0 days old
392
365
   first revision: %s
393
366
  latest revision: %s
427
400
 
428
401
Branch history:
429
402
         1 revision
 
403
         1 committer
430
404
         0 days old
431
405
   first revision: %s
432
406
  latest revision: %s
442
416
        out, err = self.run_bzr('info lightcheckout --verbose')
443
417
        self.assertEqualDiff(
444
418
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
445
 
1.9 or 1.9-rich-root or \
446
419
dirstate or dirstate-tags or \
447
420
pack-0.92 or rich-root or rich-root-pack)
448
421
Location:
469
442
 
470
443
Branch history:
471
444
         2 revisions
 
445
         1 committer
472
446
         0 days old
473
447
   first revision: %s
474
448
  latest revision: %s
496
470
 
497
471
Branch history:
498
472
         0 revisions
 
473
         0 committers
499
474
 
500
475
Repository:
501
476
         0 revisions
546
521
 
547
522
Branch history:
548
523
         0 revisions
 
524
         0 committers
549
525
 
550
526
Repository:
551
527
         0 revisions
557
533
        # Create lightweight checkout
558
534
        transport.mkdir('tree')
559
535
        transport.mkdir('tree/lightcheckout')
560
 
        tree2 = branch1.create_checkout('tree/lightcheckout',
 
536
        tree2 = branch1.create_checkout('tree/lightcheckout', 
561
537
            lightweight=True)
562
538
        branch2 = tree2.branch
563
539
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
577
553
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
578
554
        self.assertEqualDiff(
579
555
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
580
 
1.9 or 1.9-rich-root or \
581
556
dirstate or dirstate-tags or \
582
557
pack-0.92 or rich-root or rich-root-pack)
583
558
Location:
603
578
 
604
579
Branch history:
605
580
         1 revision
 
581
         1 committer
606
582
         0 days old
607
583
   first revision: %s
608
584
  latest revision: %s
643
619
 
644
620
Branch history:
645
621
         0 revisions
 
622
         0 committers
646
623
 
647
624
Repository:
648
625
         0 revisions
680
657
 
681
658
Branch history:
682
659
         1 revision
 
660
         1 committer
683
661
         0 days old
684
662
   first revision: %s
685
663
  latest revision: %s
699
677
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
700
678
        self.assertEqualDiff(
701
679
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
702
 
1.9 or 1.9-rich-root or \
703
680
dirstate or dirstate-tags or \
704
681
pack-0.92 or rich-root or rich-root-pack)
705
682
Location:
727
704
 
728
705
Branch history:
729
706
         2 revisions
 
707
         1 committer
730
708
         0 days old
731
709
   first revision: %s
732
710
  latest revision: %s
754
732
 
755
733
Branch history:
756
734
         2 revisions
 
735
         1 committer
757
736
         0 days old
758
737
   first revision: %s
759
738
  latest revision: %s
840
819
 
841
820
Branch history:
842
821
         0 revisions
 
822
         0 committers
843
823
 
844
824
Repository:
845
825
         0 revisions
880
860
 
881
861
Branch history:
882
862
         1 revision
 
863
         1 committer
883
864
         0 days old
884
865
   first revision: %s
885
866
  latest revision: %s
921
902
 
922
903
Branch history:
923
904
         0 revisions
 
905
         0 committers
924
906
 
925
907
Repository:
926
908
         1 revision
960
942
 
961
943
Branch history:
962
944
         1 revision
 
945
         1 committer
963
946
         0 days old
964
947
   first revision: %s
965
948
  latest revision: %s
991
974
       ),
992
975
       out)
993
976
        self.assertEqual('', err)
994
 
 
 
977
    
995
978
    def test_info_shared_repository_with_tree_in_root(self):
996
979
        format = bzrdir.format_registry.make_bzrdir('knit')
997
980
        transport = self.get_transport()
1046
1029
 
1047
1030
Branch history:
1048
1031
         0 revisions
 
1032
         0 committers
1049
1033
 
1050
1034
Repository:
1051
1035
         0 revisions
1054
1038
       ), out)
1055
1039
        self.assertEqual('', err)
1056
1040
 
1057
 
    def test_info_repository_hook(self):
1058
 
        format = bzrdir.format_registry.make_bzrdir('knit')
1059
 
        def repo_info(repo, stats, outf):
1060
 
            outf.write("more info\n")
1061
 
        info.hooks.install_named_hook('repository', repo_info, None)
1062
 
        # Create shared repository with working trees
1063
 
        repo = self.make_repository('repo', shared=True, format=format)
1064
 
        out, err = self.run_bzr('info -v repo')
1065
 
        self.assertEqualDiff(
1066
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1067
 
Location:
1068
 
  shared repository: repo
1069
 
 
1070
 
Format:
1071
 
       control: Meta directory format 1
1072
 
    repository: %s
1073
 
 
1074
 
Create working tree for new branches inside the repository.
1075
 
 
1076
 
Repository:
1077
 
         0 revisions
1078
 
more info
1079
 
""" % (format.repository_format.get_format_description(),
1080
 
       ), out)
1081
 
        self.assertEqual('', err)
1082
 
 
1083
1041
    def assertCheckoutStatusOutput(self,
1084
1042
        command_string, lco_tree, shared_repo=None,
1085
1043
        repo_branch=None,
1095
1053
        allow us, the test writers, to document what *should* be present in
1096
1054
        the output. Removing this separation would remove the value of the
1097
1055
        tests.
1098
 
 
 
1056
        
1099
1057
        :param path: the path to the light checkout.
1100
1058
        :param lco_tree: the tree object for the light checkout.
1101
1059
        :param shared_repo: A shared repository is in use, expect that in
1109
1067
            actually locked then this parameter is overridden. This is because
1110
1068
            pack repositories do not have any public API for obtaining an
1111
1069
            exclusive repository wide lock.
1112
 
        :param verbose: verbosity level: 2 or higher to show committers
 
1070
        :param verbose: If true, expect verbose output
1113
1071
        """
1114
1072
        def friendly_location(url):
1115
1073
            path = urlutils.unescape_for_display(url, 'ascii')
1135
1093
            (False, False): 'Checkout',
1136
1094
            }[(shared_repo is not None, light_checkout)]
1137
1095
        format = {True: '1.6 or 1.6.1-rich-root'
1138
 
                        ' or 1.9 or 1.9-rich-root'
1139
1096
                        ' or dirstate or dirstate-tags or pack-0.92'
1140
1097
                        ' or rich-root or rich-root-pack',
1141
1098
                  False: 'dirstate'}[light_checkout]
1181
1138
        else:
1182
1139
            branch_data = ("   checkout of branch: %s\n" %
1183
1140
                lco_tree.branch.bzrdir.root_transport.base)
1184
 
 
1185
 
        if verbose >= 2:
 
1141
        
 
1142
        if verbose:
1186
1143
            verbose_info = '         0 committers\n'
1187
1144
        else:
1188
1145
            verbose_info = ''
1189
 
 
 
1146
            
1190
1147
        self.assertEqualDiff(
1191
1148
"""%s (format: %s)
1192
1149
Location:
1374
1331
 
1375
1332
Branch history:
1376
1333
         0 revisions
 
1334
         0 committers
1377
1335
 
1378
1336
Repository:
1379
1337
         0 revisions
1406
1364
 
1407
1365
Branch history:
1408
1366
         0 revisions
 
1367
         0 committers
1409
1368
 
1410
1369
Repository:
1411
1370
         0 revisions
1417
1376
    def test_info_stacked(self):
1418
1377
        # We have a mainline
1419
1378
        trunk_tree = self.make_branch_and_tree('mainline',
1420
 
            format='1.6')
 
1379
            format='development1')
1421
1380
        trunk_tree.commit('mainline')
1422
1381
        # and a branch from it which is stacked
1423
1382
        new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1424
1383
        out, err = self.run_bzr('info newbranch')
1425
1384
        self.assertEqual(
1426
 
"""Standalone tree (format: 1.6)
 
1385
"""Standalone tree (format: development1)
1427
1386
Location:
1428
1387
  branch root: newbranch
1429
1388