~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2006-05-05 00:44:25 UTC
  • mfrom: (1697 +trunk)
  • mto: (1697.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 1701.
  • Revision ID: robertc@robertcollins.net-20060505004425-55597abf11998087
Merge HEAD.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
class TestInfo(ExternalBase):
31
31
 
 
32
    def test_info_non_existing(self):
 
33
        out, err = self.runbzr('info /i/do/not/exist/', retcode=3)
 
34
        self.assertEqual(out, '')
 
35
        self.assertEqual(err, 'bzr: ERROR: Not a branch: /i/do/not/exist/\n')
 
36
 
32
37
    def test_info_standalone(self):
33
38
        transport = self.get_transport()
34
39
 
43
48
        out, err = self.runbzr('info standalone')
44
49
        self.assertEqualDiff(
45
50
"""Location:
46
 
         branch root: %s
 
51
  branch root: %s
47
52
 
48
53
Format:
49
54
       control: All-in-one format 6
79
84
        out, err = self.runbzr('info branch --verbose')
80
85
        self.assertEqualDiff(
81
86
"""Location:
82
 
         branch root: %s
83
 
       parent branch: %s
84
 
      push to branch: %s
 
87
  branch root: %s
 
88
 
 
89
Related branches:
 
90
      parent branch: %s
 
91
  publish to branch: %s
85
92
 
86
93
Format:
87
94
       control: All-in-one format 6
108
115
 
109
116
Revision store:
110
117
         1 revision
111
 
         0 KiB
112
 
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
113
 
       branch1.bzrdir.root_transport.base,
114
 
       datestring_first, datestring_first), out)
 
118
         %d KiB
 
119
""" % (branch2.bzrdir.root_transport.base,
 
120
       branch1.bzrdir.root_transport.base,
 
121
       branch1.bzrdir.root_transport.base,
 
122
       datestring_first, datestring_first,
 
123
       # poking at _revision_store isn't all that clean, but neither is
 
124
       # having the ui test dependent on the exact overhead of a given store.
 
125
       branch2.repository._revision_store.total_size(
 
126
        branch2.repository.get_transaction())[1] / 1024,
 
127
       ), out)
115
128
        self.assertEqual('', err)
116
129
 
117
130
        # Branch and bind to standalone, needs upgrade to metadir
119
132
        # XXX: I can't get this to work through API
120
133
        self.runbzr('branch standalone bound')
121
134
        #branch3 = branch1.bzrdir.sprout('bound').open_branch()
122
 
        self.runbzr('upgrade --format=metadir bound')
123
 
        #bzrlib.upgrade.upgrade('bound', 'metadir')
 
135
        self.runbzr('upgrade --format=metaweave bound')
 
136
        #bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
124
137
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
125
138
        branch3.bind(branch1)
126
139
        out, err = self.runbzr('info bound')
127
140
        self.assertEqualDiff(
128
141
"""Location:
129
 
         branch root: %s
130
 
     bound to branch: %s
131
 
       parent branch: %s
 
142
       checkout root: %s
 
143
  checkout of branch: %s
 
144
 
 
145
Related branches:
 
146
  parent branch: %s
132
147
 
133
148
Format:
134
149
       control: Meta directory format 1
155
170
Revision store:
156
171
         1 revision
157
172
         %d KiB
158
 
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
 
173
""" % (branch3.bzrdir.root_transport.base,
 
174
       branch1.bzrdir.root_transport.base,
159
175
       branch1.bzrdir.root_transport.base,
160
176
       branch3.repository._format.get_format_description(),
161
177
       datestring_first, datestring_first,
176
192
        out, err = self.runbzr('info checkout --verbose')
177
193
        self.assertEqualDiff(
178
194
"""Location:
179
 
         branch root: %s
180
 
     bound to branch: %s
 
195
       checkout root: %s
 
196
  checkout of branch: %s
181
197
 
182
198
Format:
183
199
       control: Meta directory format 1
205
221
Revision store:
206
222
         1 revision
207
223
         %d KiB
208
 
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
 
224
""" % (branch4.bzrdir.root_transport.base,
 
225
       branch1.bzrdir.root_transport.base,
209
226
       branch4.repository._format.get_format_description(),
210
227
       datestring_first, datestring_first,
211
228
       # poking at _revision_store isn't all that clean, but neither is
228
245
        out, err = self.runbzr('info lightcheckout')
229
246
        self.assertEqualDiff(
230
247
"""Location:
231
 
       checkout root: %s
232
 
  checkout of branch: %s
 
248
  light checkout root: %s
 
249
   checkout of branch: %s
233
250
 
234
251
Format:
235
252
       control: Meta directory format 1
256
273
Revision store:
257
274
         1 revision
258
275
         0 KiB
259
 
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
260
 
       datestring_first, datestring_first), out)
 
276
""" % (tree5.bzrdir.root_transport.base,
 
277
       branch1.bzrdir.root_transport.base,
 
278
       datestring_first, datestring_first,
 
279
       ), out)
261
280
        self.assertEqual('', err)
262
281
 
263
282
        # Update initial standalone branch
271
290
        out, err = self.runbzr('info branch')
272
291
        self.assertEqualDiff(
273
292
"""Location:
274
 
         branch root: %s
275
 
       parent branch: %s
276
 
      push to branch: %s
 
293
  branch root: %s
 
294
 
 
295
Related branches:
 
296
      parent branch: %s
 
297
  publish to branch: %s
277
298
 
278
299
Format:
279
300
       control: All-in-one format 6
300
321
Revision store:
301
322
         1 revision
302
323
         0 KiB
303
 
""" % (branch2.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
304
 
       branch1.bzrdir.root_transport.base,
305
 
       datestring_first, datestring_first), out)
 
324
""" % (branch2.bzrdir.root_transport.base,
 
325
       branch1.bzrdir.root_transport.base,
 
326
       branch1.bzrdir.root_transport.base,
 
327
       datestring_first, datestring_first,
 
328
       ), out)
306
329
        self.assertEqual('', err)
307
330
 
308
331
        # Out of date bound branch
309
332
        out, err = self.runbzr('info bound')
310
333
        self.assertEqualDiff(
311
334
"""Location:
312
 
         branch root: %s
313
 
     bound to branch: %s
314
 
       parent branch: %s
 
335
       checkout root: %s
 
336
  checkout of branch: %s
 
337
 
 
338
Related branches:
 
339
  parent branch: %s
315
340
 
316
341
Format:
317
342
       control: Meta directory format 1
340
365
Revision store:
341
366
         1 revision
342
367
         %d KiB
343
 
""" % (branch3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
 
368
""" % (branch3.bzrdir.root_transport.base,
 
369
       branch1.bzrdir.root_transport.base,
344
370
       branch1.bzrdir.root_transport.base,
345
371
       branch3.repository._format.get_format_description(),
346
372
       datestring_first, datestring_first,
355
381
        out, err = self.runbzr('info checkout')
356
382
        self.assertEqualDiff(
357
383
"""Location:
358
 
         branch root: %s
359
 
     bound to branch: %s
 
384
       checkout root: %s
 
385
  checkout of branch: %s
360
386
 
361
387
Format:
362
388
       control: Meta directory format 1
385
411
Revision store:
386
412
         1 revision
387
413
         %d KiB
388
 
""" % (branch4.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
 
414
""" % (branch4.bzrdir.root_transport.base,
 
415
       branch1.bzrdir.root_transport.base,
389
416
       branch4.repository._format.get_format_description(),
390
417
       datestring_first, datestring_first,
391
418
       # poking at _revision_store isn't all that clean, but neither is
399
426
        out, err = self.runbzr('info lightcheckout --verbose')
400
427
        self.assertEqualDiff(
401
428
"""Location:
402
 
       checkout root: %s
403
 
  checkout of branch: %s
 
429
  light checkout root: %s
 
430
   checkout of branch: %s
404
431
 
405
432
Format:
406
433
       control: Meta directory format 1
430
457
Revision store:
431
458
         2 revisions
432
459
         0 KiB
433
 
""" % (tree5.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
434
 
       datestring_first, datestring_last), out)
 
460
""" % (tree5.bzrdir.root_transport.base,
 
461
       branch1.bzrdir.root_transport.base,
 
462
       datestring_first, datestring_last,
 
463
       ), out)
435
464
        self.assertEqual('', err)
436
465
 
437
466
    def test_info_shared_repository(self):
445
474
        out, err = self.runbzr('info repo')
446
475
        self.assertEqualDiff(
447
476
"""Location:
448
 
   shared repository: %s
 
477
  shared repository: %s
449
478
 
450
479
Format:
451
480
       control: Meta directory format 1
454
483
Revision store:
455
484
         0 revisions
456
485
         0 KiB
457
 
""" % (repo.bzrdir.root_transport.base, repo._format.get_format_description()),
458
 
            out)
 
486
""" % (repo.bzrdir.root_transport.base,
 
487
       repo._format.get_format_description(),
 
488
       ), out)
459
489
        self.assertEqual('', err)
460
490
 
461
491
        # Create branch inside shared repository
464
494
        out, err = self.runbzr('info repo/branch')
465
495
        self.assertEqualDiff(
466
496
"""Location:
467
 
         branch root: %s
468
 
   shared repository: %s
 
497
  shared repository: %s
 
498
  repository branch: branch
469
499
 
470
500
Format:
471
501
       control: Meta directory format 1
478
508
Revision store:
479
509
         0 revisions
480
510
         0 KiB
481
 
""" % (branch1.bzrdir.root_transport.base,
482
 
       repo.bzrdir.root_transport.base,
 
511
""" % (repo.bzrdir.root_transport.base,
483
512
       repo._format.get_format_description(),
484
513
       ), out)
485
514
        self.assertEqual('', err)
495
524
        out, err = self.runbzr('info tree/lightcheckout')
496
525
        self.assertEqualDiff(
497
526
"""Location:
498
 
       checkout root: %s
499
 
  checkout of branch: %s
500
 
   shared repository: %s
 
527
  light checkout root: %s
 
528
    shared repository: %s
 
529
    repository branch: branch
501
530
 
502
531
Format:
503
532
       control: Meta directory format 1
522
551
         0 revisions
523
552
         0 KiB
524
553
""" % (tree2.bzrdir.root_transport.base,
525
 
       branch1.bzrdir.root_transport.base,
526
554
       repo.bzrdir.root_transport.base,
527
555
       repo._format.get_format_description(),
528
556
       ), out)
536
564
        out, err = self.runbzr('info tree/checkout --verbose')
537
565
        self.assertEqualDiff(
538
566
"""Location:
539
 
         branch root: %s
540
 
     bound to branch: %s
 
567
       checkout root: %s
 
568
  checkout of branch: %s
541
569
 
542
570
Format:
543
571
       control: Meta directory format 1
577
605
        out, err = self.runbzr('info tree/lightcheckout --verbose')
578
606
        self.assertEqualDiff(
579
607
"""Location:
580
 
       checkout root: %s
581
 
  checkout of branch: %s
582
 
   shared repository: %s
 
608
  light checkout root: %s
 
609
    shared repository: %s
 
610
    repository branch: branch
583
611
 
584
612
Format:
585
613
       control: Meta directory format 1
608
636
         1 revision
609
637
         %d KiB
610
638
""" % (tree2.bzrdir.root_transport.base,
611
 
       branch1.bzrdir.root_transport.base,
612
639
       repo.bzrdir.root_transport.base,
613
640
       repo._format.get_format_description(),
614
641
       datestring_first, datestring_first,
622
649
        out, err = self.runbzr('info tree/checkout')
623
650
        self.assertEqualDiff(
624
651
"""Location:
625
 
         branch root: %s
626
 
     bound to branch: %s
 
652
       checkout root: %s
 
653
  checkout of branch: %s
627
654
 
628
655
Format:
629
656
       control: Meta directory format 1
662
689
        out, err = self.runbzr('info tree/checkout --verbose')
663
690
        self.assertEqualDiff(
664
691
"""Location:
665
 
         branch root: %s
666
 
     bound to branch: %s
 
692
       checkout root: %s
 
693
  checkout of branch: %s
667
694
 
668
695
Format:
669
696
       control: Meta directory format 1
707
734
        out, err = self.runbzr('info tree/lightcheckout --verbose')
708
735
        self.assertEqualDiff(
709
736
"""Location:
710
 
       checkout root: %s
711
 
  checkout of branch: %s
712
 
   shared repository: %s
 
737
  light checkout root: %s
 
738
    shared repository: %s
 
739
    repository branch: branch
713
740
 
714
741
Format:
715
742
       control: Meta directory format 1
740
767
         2 revisions
741
768
         %d KiB
742
769
""" % (tree2.bzrdir.root_transport.base,
743
 
       branch1.bzrdir.root_transport.base,
744
770
       repo.bzrdir.root_transport.base,
745
771
       repo._format.get_format_description(),
746
772
       datestring_first, datestring_last,
754
780
        out, err = self.runbzr('info repo/branch --verbose')
755
781
        self.assertEqualDiff(
756
782
"""Location:
757
 
         branch root: %s
758
 
   shared repository: %s
 
783
  shared repository: %s
 
784
  repository branch: branch
759
785
 
760
786
Format:
761
787
       control: Meta directory format 1
772
798
Revision store:
773
799
         2 revisions
774
800
         %d KiB
775
 
""" % (branch1.bzrdir.root_transport.base,
776
 
       repo.bzrdir.root_transport.base,
 
801
""" % (repo.bzrdir.root_transport.base,
777
802
       repo._format.get_format_description(),
778
803
       datestring_first, datestring_last,
779
804
       # poking at _revision_store isn't all that clean, but neither is
786
811
        out, err = self.runbzr('info repo')
787
812
        self.assertEqualDiff(
788
813
"""Location:
789
 
   shared repository: %s
 
814
  shared repository: %s
790
815
 
791
816
Format:
792
817
       control: Meta directory format 1
800
825
       # poking at _revision_store isn't all that clean, but neither is
801
826
       # having the ui test dependent on the exact overhead of a given store.
802
827
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
803
 
       ),
804
 
       out)
 
828
       ), out)
805
829
        self.assertEqual('', err)
806
830
 
807
831
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
817
841
        out, err = self.runbzr('info repo')
818
842
        self.assertEqualDiff(
819
843
"""Location:
820
 
   shared repository: %s
 
844
  shared repository: %s
821
845
 
822
846
Format:
823
847
       control: Meta directory format 1
842
866
        out, err = self.runbzr('info repo/branch1 --verbose')
843
867
        self.assertEqualDiff(
844
868
"""Location:
845
 
         branch root: %s
846
 
   shared repository: %s
 
869
    shared repository: %s
 
870
  repository checkout: branch1
847
871
 
848
872
Format:
849
873
       control: Meta directory format 1
868
892
Revision store:
869
893
         0 revisions
870
894
         0 KiB
871
 
""" % (branch1.bzrdir.root_transport.base,
872
 
       repo.bzrdir.root_transport.base,
 
895
""" % (repo.bzrdir.root_transport.base,
873
896
       repo._format.get_format_description(),
874
897
       ), out)
875
898
        self.assertEqual('', err)
884
907
        out, err = self.runbzr('info repo/branch1')
885
908
        self.assertEqualDiff(
886
909
"""Location:
887
 
         branch root: %s
888
 
   shared repository: %s
 
910
    shared repository: %s
 
911
  repository checkout: branch1
889
912
 
890
913
Format:
891
914
       control: Meta directory format 1
912
935
Revision store:
913
936
         1 revision
914
937
         %d KiB
915
 
""" % (branch1.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
 
938
""" % (repo.bzrdir.root_transport.base,
916
939
       repo._format.get_format_description(),
917
940
       datestring_first, datestring_first,
918
941
       # poking at _revision_store isn't all that clean, but neither is
925
948
        out, err = self.runbzr('info repo/branch2 --verbose')
926
949
        self.assertEqualDiff(
927
950
"""Location:
928
 
         branch root: %s
929
 
   shared repository: %s
930
 
       parent branch: %s
 
951
    shared repository: %s
 
952
  repository checkout: branch2
 
953
 
 
954
Related branches:
 
955
  parent branch: %s
931
956
 
932
957
Format:
933
958
       control: Meta directory format 1
952
977
Revision store:
953
978
         1 revision
954
979
         %d KiB
955
 
""" % (branch2.bzrdir.root_transport.base, repo.bzrdir.root_transport.base,
 
980
""" % (repo.bzrdir.root_transport.base,
956
981
       branch1.bzrdir.root_transport.base,
957
982
       repo._format.get_format_description(),
958
983
       # poking at _revision_store isn't all that clean, but neither is
967
992
        out, err = self.runbzr('info repo/branch2')
968
993
        self.assertEqualDiff(
969
994
"""Location:
970
 
         branch root: %s
971
 
   shared repository: %s
972
 
       parent branch: %s
 
995
    shared repository: %s
 
996
  repository checkout: branch2
 
997
 
 
998
Related branches:
 
999
  parent branch: %s
973
1000
 
974
1001
Format:
975
1002
       control: Meta directory format 1
996
1023
Revision store:
997
1024
         1 revision
998
1025
         %d KiB
999
 
""" % (branch2.bzrdir.root_transport.base,
1000
 
       repo.bzrdir.root_transport.base,
 
1026
""" % (repo.bzrdir.root_transport.base,
1001
1027
       branch1.bzrdir.root_transport.base,
1002
1028
       repo._format.get_format_description(),
1003
1029
       datestring_first, datestring_first,
1011
1037
        out, err = self.runbzr('info repo')
1012
1038
        self.assertEqualDiff(
1013
1039
"""Location:
1014
 
   shared repository: %s
 
1040
  shared repository: %s
1015
1041
 
1016
1042
Format:
1017
1043
       control: Meta directory format 1
1032
1058
        self.assertEqual('', err)
1033
1059
 
1034
1060
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
 
1061
    
 
1062
    def test_info_shared_repository_with_tree_in_root(self):
 
1063
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
1064
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
 
1065
        transport = self.get_transport()
 
1066
 
 
1067
        # Create shared repository with working trees
 
1068
        repo = self.make_repository('repo', shared=True)
 
1069
        repo.set_make_working_trees(True)
 
1070
        out, err = self.runbzr('info repo')
 
1071
        self.assertEqualDiff(
 
1072
"""Location:
 
1073
  shared repository: %s
 
1074
 
 
1075
Format:
 
1076
       control: Meta directory format 1
 
1077
    repository: %s
 
1078
 
 
1079
Create working tree for new branches inside the repository.
 
1080
 
 
1081
Revision store:
 
1082
         0 revisions
 
1083
         0 KiB
 
1084
""" % (repo.bzrdir.root_transport.base,
 
1085
       repo._format.get_format_description(),
 
1086
       ), out)
 
1087
        self.assertEqual('', err)
 
1088
 
 
1089
        # Create branch in root of repository
 
1090
        control = repo.bzrdir
 
1091
        branch = control.create_branch()
 
1092
        control.create_workingtree()
 
1093
        out, err = self.runbzr('info repo')
 
1094
        self.assertEqualDiff(
 
1095
"""Location:
 
1096
    shared repository: %s
 
1097
  repository checkout: .
 
1098
 
 
1099
Format:
 
1100
       control: Meta directory format 1
 
1101
  working tree: Working tree format 3
 
1102
        branch: Branch format 5
 
1103
    repository: %s
 
1104
 
 
1105
In the working tree:
 
1106
         0 unchanged
 
1107
         0 modified
 
1108
         0 added
 
1109
         0 removed
 
1110
         0 renamed
 
1111
         0 unknown
 
1112
         0 ignored
 
1113
         0 versioned subdirectories
 
1114
 
 
1115
Branch history:
 
1116
         0 revisions
 
1117
 
 
1118
Revision store:
 
1119
         0 revisions
 
1120
         0 KiB
 
1121
""" % (repo.bzrdir.root_transport.base,
 
1122
       repo._format.get_format_description(),
 
1123
       ), out)
 
1124
        self.assertEqual('', err)
 
1125
 
 
1126
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
 
1127
 
 
1128
    def test_info_locking(self):
 
1129
        transport = self.get_transport()
 
1130
        # Create shared repository with a branch
 
1131
        repo = self.make_repository('repo', shared=True,
 
1132
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1133
        repo.set_make_working_trees(False)
 
1134
        repo.bzrdir.root_transport.mkdir('branch')
 
1135
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
 
1136
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1137
        # Do a heavy checkout
 
1138
        transport.mkdir('tree')
 
1139
        transport.mkdir('tree/checkout')
 
1140
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1141
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1142
        co_branch.bind(repo_branch)
 
1143
        # Do a light checkout of the heavy one
 
1144
        transport.mkdir('tree/lightcheckout')
 
1145
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1146
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
 
1147
        lco_dir.create_workingtree()
 
1148
        lco_tree = lco_dir.open_workingtree()
 
1149
 
 
1150
        # Test all permutations of locking the working tree, branch and repository
 
1151
        # W B R
 
1152
 
 
1153
        # U U U
 
1154
        out, err = self.runbzr('info tree/lightcheckout')
 
1155
        self.assertEqualDiff(
 
1156
"""Location:
 
1157
  light checkout root: %s
 
1158
   checkout of branch: %s
 
1159
 
 
1160
Format:
 
1161
       control: Meta directory format 1
 
1162
  working tree: Working tree format 3
 
1163
        branch: Branch format 5
 
1164
    repository: %s
 
1165
 
 
1166
In the working tree:
 
1167
         0 unchanged
 
1168
         0 modified
 
1169
         0 added
 
1170
         0 removed
 
1171
         0 renamed
 
1172
         0 unknown
 
1173
         0 ignored
 
1174
         0 versioned subdirectories
 
1175
 
 
1176
Branch history:
 
1177
         0 revisions
 
1178
 
 
1179
Revision store:
 
1180
         0 revisions
 
1181
         0 KiB
 
1182
""" % (lco_tree.bzrdir.root_transport.base,
 
1183
       lco_tree.branch.bzrdir.root_transport.base,
 
1184
       lco_tree.branch.repository._format.get_format_description(),
 
1185
       ), out)
 
1186
        self.assertEqual('', err)
 
1187
        # U U L
 
1188
        lco_tree.branch.repository.lock_write()
 
1189
        out, err = self.runbzr('info tree/lightcheckout')
 
1190
        self.assertEqualDiff(
 
1191
"""Location:
 
1192
  light checkout root: %s
 
1193
   checkout of branch: %s
 
1194
 
 
1195
Format:
 
1196
       control: Meta directory format 1
 
1197
  working tree: Working tree format 3
 
1198
        branch: Branch format 5
 
1199
    repository: %s
 
1200
 
 
1201
Lock status:
 
1202
  working tree: unlocked
 
1203
        branch: unlocked
 
1204
    repository: locked
 
1205
 
 
1206
In the working tree:
 
1207
         0 unchanged
 
1208
         0 modified
 
1209
         0 added
 
1210
         0 removed
 
1211
         0 renamed
 
1212
         0 unknown
 
1213
         0 ignored
 
1214
         0 versioned subdirectories
 
1215
 
 
1216
Branch history:
 
1217
         0 revisions
 
1218
 
 
1219
Revision store:
 
1220
         0 revisions
 
1221
         0 KiB
 
1222
""" % (lco_tree.bzrdir.root_transport.base,
 
1223
       lco_tree.branch.bzrdir.root_transport.base,
 
1224
       lco_tree.branch.repository._format.get_format_description(),
 
1225
       ), out)
 
1226
        self.assertEqual('', err)
 
1227
        lco_tree.branch.repository.unlock()
 
1228
        # U L L
 
1229
        lco_tree.branch.lock_write()
 
1230
        out, err = self.runbzr('info tree/lightcheckout')
 
1231
        self.assertEqualDiff(
 
1232
"""Location:
 
1233
  light checkout root: %s
 
1234
   checkout of branch: %s
 
1235
 
 
1236
Format:
 
1237
       control: Meta directory format 1
 
1238
  working tree: Working tree format 3
 
1239
        branch: Branch format 5
 
1240
    repository: %s
 
1241
 
 
1242
Lock status:
 
1243
  working tree: unlocked
 
1244
        branch: locked
 
1245
    repository: locked
 
1246
 
 
1247
In the working tree:
 
1248
         0 unchanged
 
1249
         0 modified
 
1250
         0 added
 
1251
         0 removed
 
1252
         0 renamed
 
1253
         0 unknown
 
1254
         0 ignored
 
1255
         0 versioned subdirectories
 
1256
 
 
1257
Branch history:
 
1258
         0 revisions
 
1259
 
 
1260
Revision store:
 
1261
         0 revisions
 
1262
         0 KiB
 
1263
""" % (lco_tree.bzrdir.root_transport.base,
 
1264
       lco_tree.branch.bzrdir.root_transport.base,
 
1265
       lco_tree.branch.repository._format.get_format_description(),
 
1266
       ), out)
 
1267
        self.assertEqual('', err)
 
1268
        lco_tree.branch.unlock()
 
1269
        # L L L
 
1270
        lco_tree.lock_write()
 
1271
        out, err = self.runbzr('info tree/lightcheckout')
 
1272
        self.assertEqualDiff(
 
1273
"""Location:
 
1274
  light checkout root: %s
 
1275
   checkout of branch: %s
 
1276
 
 
1277
Format:
 
1278
       control: Meta directory format 1
 
1279
  working tree: Working tree format 3
 
1280
        branch: Branch format 5
 
1281
    repository: %s
 
1282
 
 
1283
Lock status:
 
1284
  working tree: locked
 
1285
        branch: locked
 
1286
    repository: locked
 
1287
 
 
1288
In the working tree:
 
1289
         0 unchanged
 
1290
         0 modified
 
1291
         0 added
 
1292
         0 removed
 
1293
         0 renamed
 
1294
         0 unknown
 
1295
         0 ignored
 
1296
         0 versioned subdirectories
 
1297
 
 
1298
Branch history:
 
1299
         0 revisions
 
1300
 
 
1301
Revision store:
 
1302
         0 revisions
 
1303
         0 KiB
 
1304
""" % (lco_tree.bzrdir.root_transport.base,
 
1305
       lco_tree.branch.bzrdir.root_transport.base,
 
1306
       lco_tree.branch.repository._format.get_format_description(),
 
1307
       ), out)
 
1308
        self.assertEqual('', err)
 
1309
        lco_tree.unlock()
 
1310
        # L L U
 
1311
        lco_tree.lock_write()
 
1312
        lco_tree.branch.repository.unlock()
 
1313
        out, err = self.runbzr('info tree/lightcheckout')
 
1314
        self.assertEqualDiff(
 
1315
"""Location:
 
1316
  light checkout root: %s
 
1317
   checkout of branch: %s
 
1318
 
 
1319
Format:
 
1320
       control: Meta directory format 1
 
1321
  working tree: Working tree format 3
 
1322
        branch: Branch format 5
 
1323
    repository: %s
 
1324
 
 
1325
Lock status:
 
1326
  working tree: locked
 
1327
        branch: locked
 
1328
    repository: unlocked
 
1329
 
 
1330
In the working tree:
 
1331
         0 unchanged
 
1332
         0 modified
 
1333
         0 added
 
1334
         0 removed
 
1335
         0 renamed
 
1336
         0 unknown
 
1337
         0 ignored
 
1338
         0 versioned subdirectories
 
1339
 
 
1340
Branch history:
 
1341
         0 revisions
 
1342
 
 
1343
Revision store:
 
1344
         0 revisions
 
1345
         0 KiB
 
1346
""" % (lco_tree.bzrdir.root_transport.base,
 
1347
       lco_tree.branch.bzrdir.root_transport.base,
 
1348
       lco_tree.branch.repository._format.get_format_description(),
 
1349
       ), out)
 
1350
        self.assertEqual('', err)
 
1351
        lco_tree.branch.repository.lock_write()
 
1352
        lco_tree.unlock()
 
1353
        # L U U
 
1354
        lco_tree.lock_write()
 
1355
        lco_tree.branch.unlock()
 
1356
        out, err = self.runbzr('info tree/lightcheckout')
 
1357
        self.assertEqualDiff(
 
1358
"""Location:
 
1359
  light checkout root: %s
 
1360
   checkout of branch: %s
 
1361
 
 
1362
Format:
 
1363
       control: Meta directory format 1
 
1364
  working tree: Working tree format 3
 
1365
        branch: Branch format 5
 
1366
    repository: %s
 
1367
 
 
1368
Lock status:
 
1369
  working tree: locked
 
1370
        branch: unlocked
 
1371
    repository: unlocked
 
1372
 
 
1373
In the working tree:
 
1374
         0 unchanged
 
1375
         0 modified
 
1376
         0 added
 
1377
         0 removed
 
1378
         0 renamed
 
1379
         0 unknown
 
1380
         0 ignored
 
1381
         0 versioned subdirectories
 
1382
 
 
1383
Branch history:
 
1384
         0 revisions
 
1385
 
 
1386
Revision store:
 
1387
         0 revisions
 
1388
         0 KiB
 
1389
""" % (lco_tree.bzrdir.root_transport.base,
 
1390
       lco_tree.branch.bzrdir.root_transport.base,
 
1391
       lco_tree.branch.repository._format.get_format_description(),
 
1392
       ), out)
 
1393
        self.assertEqual('', err)
 
1394
        lco_tree.branch.lock_write()
 
1395
        lco_tree.unlock()
 
1396
        # L U L
 
1397
        lco_tree.lock_write()
 
1398
        lco_tree.branch.unlock()
 
1399
        lco_tree.branch.repository.lock_write()
 
1400
        out, err = self.runbzr('info tree/lightcheckout')
 
1401
        self.assertEqualDiff(
 
1402
"""Location:
 
1403
  light checkout root: %s
 
1404
   checkout of branch: %s
 
1405
 
 
1406
Format:
 
1407
       control: Meta directory format 1
 
1408
  working tree: Working tree format 3
 
1409
        branch: Branch format 5
 
1410
    repository: %s
 
1411
 
 
1412
Lock status:
 
1413
  working tree: locked
 
1414
        branch: unlocked
 
1415
    repository: locked
 
1416
 
 
1417
In the working tree:
 
1418
         0 unchanged
 
1419
         0 modified
 
1420
         0 added
 
1421
         0 removed
 
1422
         0 renamed
 
1423
         0 unknown
 
1424
         0 ignored
 
1425
         0 versioned subdirectories
 
1426
 
 
1427
Branch history:
 
1428
         0 revisions
 
1429
 
 
1430
Revision store:
 
1431
         0 revisions
 
1432
         0 KiB
 
1433
""" % (lco_tree.bzrdir.root_transport.base,
 
1434
       lco_tree.branch.bzrdir.root_transport.base,
 
1435
       lco_tree.branch.repository._format.get_format_description(),
 
1436
       ), out)
 
1437
        self.assertEqual('', err)
 
1438
        lco_tree.branch.repository.unlock()
 
1439
        lco_tree.branch.lock_write()
 
1440
        lco_tree.unlock()
 
1441
        # U L U
 
1442
        lco_tree.branch.lock_write()
 
1443
        lco_tree.branch.repository.unlock()
 
1444
        out, err = self.runbzr('info tree/lightcheckout')
 
1445
        self.assertEqualDiff(
 
1446
"""Location:
 
1447
  light checkout root: %s
 
1448
   checkout of branch: %s
 
1449
 
 
1450
Format:
 
1451
       control: Meta directory format 1
 
1452
  working tree: Working tree format 3
 
1453
        branch: Branch format 5
 
1454
    repository: %s
 
1455
 
 
1456
Lock status:
 
1457
  working tree: unlocked
 
1458
        branch: locked
 
1459
    repository: unlocked
 
1460
 
 
1461
In the working tree:
 
1462
         0 unchanged
 
1463
         0 modified
 
1464
         0 added
 
1465
         0 removed
 
1466
         0 renamed
 
1467
         0 unknown
 
1468
         0 ignored
 
1469
         0 versioned subdirectories
 
1470
 
 
1471
Branch history:
 
1472
         0 revisions
 
1473
 
 
1474
Revision store:
 
1475
         0 revisions
 
1476
         0 KiB
 
1477
""" % (lco_tree.bzrdir.root_transport.base,
 
1478
       lco_tree.branch.bzrdir.root_transport.base,
 
1479
       lco_tree.branch.repository._format.get_format_description(),
 
1480
       ), out)
 
1481
        self.assertEqual('', err)
 
1482
        lco_tree.branch.repository.lock_write()
 
1483
        lco_tree.branch.unlock()
 
1484
 
 
1485
    def test_info_locking_oslocks(self):
 
1486
        tree = self.make_branch_and_tree('branch',
 
1487
                                         format=bzrlib.bzrdir.BzrDirFormat6())
 
1488
 
 
1489
        # Test all permutations of locking the working tree, branch and repository
 
1490
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
 
1491
        # implemented by raising NotImplementedError and get_physical_lock_status()
 
1492
        # always returns false. This makes bzr info hide the lock status.  (Olaf)
 
1493
        # W B R
 
1494
 
 
1495
        # U U U
 
1496
        out, err = self.runbzr('info branch')
 
1497
        self.assertEqualDiff(
 
1498
"""Location:
 
1499
  branch root: %s
 
1500
 
 
1501
Format:
 
1502
       control: All-in-one format 6
 
1503
  working tree: Working tree format 2
 
1504
        branch: Branch format 4
 
1505
    repository: %s
 
1506
 
 
1507
In the working tree:
 
1508
         0 unchanged
 
1509
         0 modified
 
1510
         0 added
 
1511
         0 removed
 
1512
         0 renamed
 
1513
         0 unknown
 
1514
         0 ignored
 
1515
         0 versioned subdirectories
 
1516
 
 
1517
Branch history:
 
1518
         0 revisions
 
1519
 
 
1520
Revision store:
 
1521
         0 revisions
 
1522
         0 KiB
 
1523
""" % (tree.bzrdir.root_transport.base,
 
1524
       tree.branch.repository._format.get_format_description(),
 
1525
       ), out)
 
1526
        self.assertEqual('', err)
 
1527
        # L L L
 
1528
        tree.lock_write()
 
1529
        out, err = self.runbzr('info branch')
 
1530
        self.assertEqualDiff(
 
1531
"""Location:
 
1532
  branch root: %s
 
1533
 
 
1534
Format:
 
1535
       control: All-in-one format 6
 
1536
  working tree: Working tree format 2
 
1537
        branch: Branch format 4
 
1538
    repository: %s
 
1539
 
 
1540
In the working tree:
 
1541
         0 unchanged
 
1542
         0 modified
 
1543
         0 added
 
1544
         0 removed
 
1545
         0 renamed
 
1546
         0 unknown
 
1547
         0 ignored
 
1548
         0 versioned subdirectories
 
1549
 
 
1550
Branch history:
 
1551
         0 revisions
 
1552
 
 
1553
Revision store:
 
1554
         0 revisions
 
1555
         0 KiB
 
1556
""" % (tree.bzrdir.root_transport.base,
 
1557
       tree.branch.repository._format.get_format_description(),
 
1558
       ), out)
 
1559
        self.assertEqual('', err)
 
1560
        tree.unlock()