~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-05-03 08:05:05 UTC
  • mfrom: (1624.3.45 bzr.olaf.info)
  • mto: This revision was merged to the branch mainline in revision 1697.
  • Revision ID: mbp@sourcefrog.net-20060503080505-dd3f40f3ee57b137
[merge] bzr info and lock improvements (olaf)

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