~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: 2008-06-05 04:05:05 UTC
  • mfrom: (3473.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20080605040505-i9kqxg2fps2qjdi0
Add the 'alias' command (Tim Penhey)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for the info command of bzr."""
19
19
 
 
20
import os
20
21
import sys
21
22
 
 
23
import bzrlib
22
24
from bzrlib import (
23
 
    branch,
24
25
    bzrdir,
25
26
    errors,
26
27
    info,
27
28
    osutils,
28
 
    upgrade,
 
29
    repository,
29
30
    urlutils,
30
31
    )
31
32
from bzrlib.osutils import format_date
89
90
 
90
91
Repository:
91
92
         0 revisions
 
93
         0 KiB
92
94
""", out)
93
95
        self.assertEqual('', err)
94
96
        tree1.commit('commit one')
146
148
 
147
149
Repository:
148
150
         1 revision
 
151
         %d KiB
149
152
""" % (datestring_first, datestring_first,
 
153
       # poking at _revision_store isn't all that clean, but neither is
 
154
       # having the ui test dependent on the exact overhead of a given store.
 
155
       branch2.repository._revision_store.total_size(
 
156
        branch2.repository.get_transaction())[1] / 1024,
150
157
       ), out)
151
158
        self.assertEqual('', err)
152
159
 
154
161
        # (creates backup as unknown)
155
162
        branch1.bzrdir.sprout('bound')
156
163
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
157
 
        upgrade.upgrade('bound', knit1_format)
158
 
        branch3 = bzrdir.BzrDir.open('bound').open_branch()
 
164
        bzrlib.upgrade.upgrade('bound', knit1_format)
 
165
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
159
166
        branch3.bind(branch1)
160
167
        bound_tree = branch3.bzrdir.open_workingtree()
161
168
        out, err = self.run_bzr('info -v bound')
193
200
 
194
201
Repository:
195
202
         1 revision
 
203
         %d KiB
196
204
""" % (bound_tree._format.get_format_description(),
197
205
       branch3._format.get_format_description(),
198
206
       branch3.repository._format.get_format_description(),
199
207
       datestring_first, datestring_first,
 
208
       # poking at _revision_store isn't all that clean, but neither is
 
209
       # having the ui test dependent on the exact overhead of a given store.
 
210
       branch3.repository._revision_store.total_size(
 
211
        branch3.repository.get_transaction())[1] / 1024,
200
212
       ), out)
201
213
        self.assertEqual('', err)
202
214
 
203
215
        # Checkout standalone (same as above, but does not have parent set)
204
 
        branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
 
216
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
205
217
            format=knit1_format)
206
218
        branch4.bind(branch1)
207
219
        branch4.bzrdir.open_workingtree().update()
237
249
 
238
250
Repository:
239
251
         1 revision
 
252
         %d KiB
240
253
""" % (branch4.repository._format.get_format_description(),
241
254
       datestring_first, datestring_first,
 
255
       # poking at _revision_store isn't all that clean, but neither is
 
256
       # having the ui test dependent on the exact overhead of a given store.
 
257
       branch4.repository._revision_store.total_size(
 
258
        branch4.repository.get_transaction())[1] / 1024,
242
259
       ), out)
243
260
        self.assertEqual('', err)
244
261
 
247
264
        branch5 = tree5.branch
248
265
        out, err = self.run_bzr('info -v lightcheckout')
249
266
        self.assertEqualDiff(
250
 
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root \
251
 
or dirstate or dirstate-tags or \
 
267
"""Lightweight checkout (format: dirstate or dirstate-tags or \
252
268
pack-0.92 or rich-root or rich-root-pack)
253
269
Location:
254
270
  light checkout root: lightcheckout
279
295
 
280
296
Repository:
281
297
         1 revision
 
298
         0 KiB
282
299
""" % (datestring_first, datestring_first,), out)
283
300
        self.assertEqual('', err)
284
301
 
325
342
 
326
343
Repository:
327
344
         1 revision
 
345
         0 KiB
328
346
""" % (datestring_first, datestring_first,
329
347
       ), out)
330
348
        self.assertEqual('', err)
367
385
 
368
386
Repository:
369
387
         1 revision
 
388
         %d KiB
370
389
""" % (branch3.repository._format.get_format_description(),
371
390
       datestring_first, datestring_first,
 
391
       # poking at _revision_store isn't all that clean, but neither is
 
392
       # having the ui test dependent on the exact overhead of a given store.
 
393
       branch3.repository._revision_store.total_size(
 
394
        branch3.repository.get_transaction())[1] / 1024,
372
395
       ), out)
373
396
        self.assertEqual('', err)
374
397
 
407
430
 
408
431
Repository:
409
432
         1 revision
 
433
         %d KiB
410
434
""" % (branch4.repository._format.get_format_description(),
411
435
       datestring_first, datestring_first,
 
436
       # poking at _revision_store isn't all that clean, but neither is
 
437
       # having the ui test dependent on the exact overhead of a given store.
 
438
       branch4.repository._revision_store.total_size(
 
439
        branch4.repository.get_transaction())[1] / 1024,
412
440
       ), out)
413
441
        self.assertEqual('', err)
414
442
 
415
443
        # Out of date lightweight checkout
416
444
        out, err = self.run_bzr('info lightcheckout --verbose')
417
445
        self.assertEqualDiff(
418
 
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
419
 
dirstate or dirstate-tags or \
 
446
"""Lightweight checkout (format: dirstate or dirstate-tags or \
420
447
pack-0.92 or rich-root or rich-root-pack)
421
448
Location:
422
449
  light checkout root: lightcheckout
449
476
 
450
477
Repository:
451
478
         2 revisions
 
479
         0 KiB
452
480
""" % (datestring_first, datestring_last,), out)
453
481
        self.assertEqual('', err)
454
482
 
474
502
 
475
503
Repository:
476
504
         0 revisions
 
505
         0 KiB
477
506
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
478
507
       format.get_branch_format().get_format_description(),
479
508
       format.repository_format.get_format_description(),
499
528
 
500
529
Repository:
501
530
         0 revisions
 
531
         0 KiB
502
532
""" % ('repo', format.repository_format.get_format_description(),
503
533
       ), out)
504
534
        self.assertEqual('', err)
525
555
 
526
556
Repository:
527
557
         0 revisions
 
558
         0 KiB
528
559
""" % (format.get_branch_format().get_format_description(),
529
560
       format.repository_format.get_format_description(),
530
561
       ), out)
552
583
        datestring_first = format_date(rev.timestamp, rev.timezone)
553
584
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
554
585
        self.assertEqualDiff(
555
 
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
556
 
dirstate or dirstate-tags or \
 
586
"""Lightweight checkout (format: dirstate or dirstate-tags or \
557
587
pack-0.92 or rich-root or rich-root-pack)
558
588
Location:
559
589
  light checkout root: tree/lightcheckout
585
615
 
586
616
Repository:
587
617
         1 revision
 
618
         %d KiB
588
619
""" % (format.get_branch_format().get_format_description(),
589
620
       format.repository_format.get_format_description(),
590
621
       datestring_first, datestring_first,
 
622
       # poking at _revision_store isn't all that clean, but neither is
 
623
       # having the ui test dependent on the exact overhead of a given store.
 
624
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
591
625
       ), out)
592
626
        self.assertEqual('', err)
593
627
 
623
657
 
624
658
Repository:
625
659
         0 revisions
 
660
         0 KiB
626
661
""" % (format.get_branch_format().get_format_description(),
627
662
       format.repository_format.get_format_description(),
628
663
       ), out)
664
699
 
665
700
Repository:
666
701
         1 revision
 
702
         %d KiB
667
703
""" % (format.get_branch_format().get_format_description(),
668
704
       format.repository_format.get_format_description(),
669
705
       datestring_first, datestring_first,
 
706
       # poking at _revision_store isn't all that clean, but neither is
 
707
       # having the ui test dependent on the exact overhead of a given store.
 
708
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
670
709
       ), out)
671
710
        self.assertEqual('', err)
672
711
        tree3.commit('commit two')
676
715
        datestring_last = format_date(rev.timestamp, rev.timezone)
677
716
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
678
717
        self.assertEqualDiff(
679
 
"""Lightweight checkout (format: 1.6 or 1.6.1-rich-root or \
680
 
dirstate or dirstate-tags or \
 
718
"""Lightweight checkout (format: dirstate or dirstate-tags or \
681
719
pack-0.92 or rich-root or rich-root-pack)
682
720
Location:
683
721
  light checkout root: tree/lightcheckout
711
749
 
712
750
Repository:
713
751
         2 revisions
 
752
         %d KiB
714
753
""" % (format.get_branch_format().get_format_description(),
715
754
       format.repository_format.get_format_description(),
716
755
       datestring_first, datestring_last,
 
756
       # poking at _revision_store isn't all that clean, but neither is
 
757
       # having the ui test dependent on the exact overhead of a given store.
 
758
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
717
759
       ), out)
718
760
        self.assertEqual('', err)
719
761
 
739
781
 
740
782
Repository:
741
783
         2 revisions
 
784
         %d KiB
742
785
""" % (format.get_branch_format().get_format_description(),
743
786
       format.repository_format.get_format_description(),
744
787
       datestring_first, datestring_last,
 
788
       # poking at _revision_store isn't all that clean, but neither is
 
789
       # having the ui test dependent on the exact overhead of a given store.
 
790
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
745
791
       ), out)
746
792
        self.assertEqual('', err)
747
793
 
758
804
 
759
805
Repository:
760
806
         2 revisions
 
807
         %d KiB
761
808
""" % (format.repository_format.get_format_description(),
 
809
       # poking at _revision_store isn't all that clean, but neither is
 
810
       # having the ui test dependent on the exact overhead of a given store.
 
811
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
762
812
       ), out)
763
813
        self.assertEqual('', err)
764
814
 
783
833
 
784
834
Repository:
785
835
         0 revisions
 
836
         0 KiB
786
837
""" % (format.repository_format.get_format_description(),
787
838
       ), out)
788
839
        self.assertEqual('', err)
823
874
 
824
875
Repository:
825
876
         0 revisions
 
877
         0 KiB
826
878
""" % (format.get_branch_format().get_format_description(),
827
879
       format.repository_format.get_format_description(),
828
880
       ), out)
867
919
 
868
920
Repository:
869
921
         1 revision
 
922
         %d KiB
870
923
""" % (format.get_branch_format().get_format_description(),
871
924
       format.repository_format.get_format_description(),
872
925
       datestring_first, datestring_first,
 
926
       # poking at _revision_store isn't all that clean, but neither is
 
927
       # having the ui test dependent on the exact overhead of a given store.
 
928
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
873
929
       ), out)
874
930
        self.assertEqual('', err)
875
931
 
906
962
 
907
963
Repository:
908
964
         1 revision
 
965
         %d KiB
909
966
""" % (format.get_branch_format().get_format_description(),
910
967
       format.repository_format.get_format_description(),
 
968
       # poking at _revision_store isn't all that clean, but neither is
 
969
       # having the ui test dependent on the exact overhead of a given store.
 
970
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
911
971
       ), out)
912
972
        self.assertEqual('', err)
913
973
 
949
1009
 
950
1010
Repository:
951
1011
         1 revision
 
1012
         %d KiB
952
1013
""" % (format.get_branch_format().get_format_description(),
953
1014
       format.repository_format.get_format_description(),
954
1015
       datestring_first, datestring_first,
 
1016
       # poking at _revision_store isn't all that clean, but neither is
 
1017
       # having the ui test dependent on the exact overhead of a given store.
 
1018
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
955
1019
       ), out)
956
1020
        self.assertEqual('', err)
957
1021
 
970
1034
 
971
1035
Repository:
972
1036
         1 revision
 
1037
         %d KiB
973
1038
""" % (format.repository_format.get_format_description(),
 
1039
       # poking at _revision_store isn't all that clean, but neither is
 
1040
       # having the ui test dependent on the exact overhead of a given store.
 
1041
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
974
1042
       ),
975
1043
       out)
976
1044
        self.assertEqual('', err)
996
1064
 
997
1065
Repository:
998
1066
         0 revisions
 
1067
         0 KiB
999
1068
""" % (format.repository_format.get_format_description(),
1000
1069
       ), out)
1001
1070
        self.assertEqual('', err)
1033
1102
 
1034
1103
Repository:
1035
1104
         0 revisions
 
1105
         0 KiB
1036
1106
""" % (format.get_branch_format().get_format_description(),
1037
1107
       format.repository_format.get_format_description(),
1038
1108
       ), out)
1092
1162
            (False, True): 'Lightweight checkout',
1093
1163
            (False, False): 'Checkout',
1094
1164
            }[(shared_repo is not None, light_checkout)]
1095
 
        format = {True: '1.6 or 1.6.1-rich-root'
1096
 
                        ' or dirstate or dirstate-tags or pack-0.92'
 
1165
        format = {True: 'dirstate or dirstate-tags or pack-0.92'
1097
1166
                        ' or rich-root or rich-root-pack',
1098
1167
                  False: 'dirstate'}[light_checkout]
1099
1168
        if repo_locked:
1169
1238
%s
1170
1239
Repository:
1171
1240
         0 revisions
 
1241
         0 KiB
1172
1242
""" %  (description,
1173
1243
        format,
1174
1244
        tree_data,
1185
1255
        transport = self.get_transport()
1186
1256
        # Create shared repository with a branch
1187
1257
        repo = self.make_repository('repo', shared=True,
1188
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1258
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1189
1259
        repo.set_make_working_trees(False)
1190
1260
        repo.bzrdir.root_transport.mkdir('branch')
1191
1261
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1192
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1262
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1193
1263
        # Do a heavy checkout
1194
1264
        transport.mkdir('tree')
1195
1265
        transport.mkdir('tree/checkout')
1196
 
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1197
 
            format=bzrdir.BzrDirMetaFormat1())
 
1266
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1267
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
1198
1268
        co_branch.bind(repo_branch)
1199
1269
        # Do a light checkout of the heavy one
1200
1270
        transport.mkdir('tree/lightcheckout')
1201
 
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1202
 
        branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
 
1271
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1272
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1203
1273
        lco_dir.create_workingtree()
1204
1274
        lco_tree = lco_dir.open_workingtree()
1205
1275
 
1298
1368
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1299
1369
 
1300
1370
        tree = self.make_branch_and_tree('branch',
1301
 
                                         format=bzrdir.BzrDirFormat6())
 
1371
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1302
1372
 
1303
1373
        # Test all permutations of locking the working tree, branch and repository
1304
1374
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1335
1405
 
1336
1406
Repository:
1337
1407
         0 revisions
 
1408
         0 KiB
1338
1409
""" % ('branch', tree.branch.repository._format.get_format_description(),
1339
1410
       ), out)
1340
1411
        self.assertEqual('', err)
1368
1439
 
1369
1440
Repository:
1370
1441
         0 revisions
 
1442
         0 KiB
1371
1443
""" % ('branch', tree.branch.repository._format.get_format_description(),
1372
1444
       ), out)
1373
1445
        self.assertEqual('', err)
1374
1446
        tree.unlock()
1375
 
 
1376
 
    def test_info_stacked(self):
1377
 
        # We have a mainline
1378
 
        trunk_tree = self.make_branch_and_tree('mainline',
1379
 
            format='1.6')
1380
 
        trunk_tree.commit('mainline')
1381
 
        # and a branch from it which is stacked
1382
 
        new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1383
 
        out, err = self.run_bzr('info newbranch')
1384
 
        self.assertEqual(
1385
 
"""Standalone tree (format: 1.6)
1386
 
Location:
1387
 
  branch root: newbranch
1388
 
 
1389
 
Related branches:
1390
 
  parent branch: mainline
1391
 
     stacked on: mainline
1392
 
""", out)
1393
 
        self.assertEqual("", err)