~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

NEWS section template into a separate file

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
"""Tests for the info command of bzr."""
19
19
 
20
 
import os
21
20
import sys
22
21
 
23
 
import bzrlib
24
22
from bzrlib import (
 
23
    branch,
25
24
    bzrdir,
 
25
    errors,
 
26
    info,
26
27
    osutils,
27
 
    repository,
 
28
    upgrade,
28
29
    urlutils,
29
30
    )
30
31
from bzrlib.osutils import format_date
34
35
 
35
36
class TestInfo(ExternalBase):
36
37
 
 
38
    def setUp(self):
 
39
        ExternalBase.setUp(self)
 
40
        self._repo_strings = "2a or development-subtree"
 
41
 
37
42
    def test_info_non_existing(self):
38
43
        if sys.platform == "win32":
39
44
            location = "C:/i/do/not/exist/"
60
65
""", out)
61
66
        self.assertEqual('', err)
62
67
 
 
68
        # Standalone branch - verbose mode
63
69
        out, err = self.run_bzr('info standalone -v')
64
70
        self.assertEqualDiff(
65
71
"""Standalone tree (format: weave)
84
90
 
85
91
Branch history:
86
92
         0 revisions
 
93
 
 
94
Repository:
 
95
         0 revisions
 
96
""", out)
 
97
        self.assertEqual('', err)
 
98
 
 
99
        # Standalone branch - really verbose mode
 
100
        out, err = self.run_bzr('info standalone -vv')
 
101
        self.assertEqualDiff(
 
102
"""Standalone tree (format: weave)
 
103
Location:
 
104
  branch root: standalone
 
105
 
 
106
Format:
 
107
       control: All-in-one format 6
 
108
  working tree: Working tree format 2
 
109
        branch: Branch format 4
 
110
    repository: Weave repository format 6
 
111
 
 
112
In the working tree:
 
113
         0 unchanged
 
114
         0 modified
 
115
         1 added
 
116
         0 removed
 
117
         0 renamed
 
118
         0 unknown
 
119
         0 ignored
 
120
         0 versioned subdirectories
 
121
 
 
122
Branch history:
 
123
         0 revisions
87
124
         0 committers
88
125
 
89
126
Repository:
90
127
         0 revisions
91
 
         0 KiB
92
128
""", out)
93
129
        self.assertEqual('', err)
94
130
        tree1.commit('commit one')
139
175
 
140
176
Branch history:
141
177
         1 revision
142
 
         1 committer
143
178
         0 days old
144
179
   first revision: %s
145
180
  latest revision: %s
146
181
 
147
182
Repository:
148
183
         1 revision
149
 
         %d KiB
150
184
""" % (datestring_first, datestring_first,
151
 
       # poking at _revision_store isn't all that clean, but neither is
152
 
       # having the ui test dependent on the exact overhead of a given store.
153
 
       branch2.repository._revision_store.total_size(
154
 
        branch2.repository.get_transaction())[1] / 1024,
155
185
       ), out)
156
186
        self.assertEqual('', err)
157
187
 
159
189
        # (creates backup as unknown)
160
190
        branch1.bzrdir.sprout('bound')
161
191
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
162
 
        bzrlib.upgrade.upgrade('bound', knit1_format)
163
 
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
 
192
        upgrade.upgrade('bound', knit1_format)
 
193
        branch3 = bzrdir.BzrDir.open('bound').open_branch()
164
194
        branch3.bind(branch1)
165
195
        bound_tree = branch3.bzrdir.open_workingtree()
166
196
        out, err = self.run_bzr('info -v bound')
191
221
 
192
222
Branch history:
193
223
         1 revision
194
 
         1 committer
195
224
         0 days old
196
225
   first revision: %s
197
226
  latest revision: %s
198
227
 
199
228
Repository:
200
229
         1 revision
201
 
         %d KiB
202
230
""" % (bound_tree._format.get_format_description(),
203
231
       branch3._format.get_format_description(),
204
232
       branch3.repository._format.get_format_description(),
205
233
       datestring_first, datestring_first,
206
 
       # poking at _revision_store isn't all that clean, but neither is
207
 
       # having the ui test dependent on the exact overhead of a given store.
208
 
       branch3.repository._revision_store.total_size(
209
 
        branch3.repository.get_transaction())[1] / 1024,
210
234
       ), out)
211
235
        self.assertEqual('', err)
212
236
 
213
237
        # Checkout standalone (same as above, but does not have parent set)
214
 
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
 
238
        branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
215
239
            format=knit1_format)
216
240
        branch4.bind(branch1)
217
241
        branch4.bzrdir.open_workingtree().update()
240
264
 
241
265
Branch history:
242
266
         1 revision
243
 
         1 committer
244
267
         0 days old
245
268
   first revision: %s
246
269
  latest revision: %s
247
270
 
248
271
Repository:
249
272
         1 revision
250
 
         %d KiB
251
273
""" % (branch4.repository._format.get_format_description(),
252
274
       datestring_first, datestring_first,
253
 
       # poking at _revision_store isn't all that clean, but neither is
254
 
       # having the ui test dependent on the exact overhead of a given store.
255
 
       branch4.repository._revision_store.total_size(
256
 
        branch4.repository.get_transaction())[1] / 1024,
257
275
       ), out)
258
276
        self.assertEqual('', err)
259
277
 
262
280
        branch5 = tree5.branch
263
281
        out, err = self.run_bzr('info -v lightcheckout')
264
282
        self.assertEqualDiff(
265
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
283
"""Lightweight checkout (format: %s)
266
284
Location:
267
285
  light checkout root: lightcheckout
268
286
   checkout of branch: standalone
269
287
 
270
288
Format:
271
289
       control: Meta directory format 1
272
 
  working tree: Working tree format 4
 
290
  working tree: Working tree format 6
273
291
        branch: Branch format 4
274
292
    repository: Weave repository format 6
275
293
 
285
303
 
286
304
Branch history:
287
305
         1 revision
288
 
         1 committer
289
306
         0 days old
290
307
   first revision: %s
291
308
  latest revision: %s
292
309
 
293
310
Repository:
294
311
         1 revision
295
 
         0 KiB
296
 
""" % (datestring_first, datestring_first,), out)
 
312
""" % (self._repo_strings, datestring_first, datestring_first,), out)
297
313
        self.assertEqual('', err)
298
314
 
299
315
        # Update initial standalone branch
332
348
 
333
349
Branch history:
334
350
         1 revision
335
 
         1 committer
336
351
         0 days old
337
352
   first revision: %s
338
353
  latest revision: %s
339
354
 
340
355
Repository:
341
356
         1 revision
342
 
         0 KiB
343
357
""" % (datestring_first, datestring_first,
344
358
       ), out)
345
359
        self.assertEqual('', err)
375
389
 
376
390
Branch history:
377
391
         1 revision
378
 
         1 committer
379
392
         0 days old
380
393
   first revision: %s
381
394
  latest revision: %s
382
395
 
383
396
Repository:
384
397
         1 revision
385
 
         %d KiB
386
398
""" % (branch3.repository._format.get_format_description(),
387
399
       datestring_first, datestring_first,
388
 
       # poking at _revision_store isn't all that clean, but neither is
389
 
       # having the ui test dependent on the exact overhead of a given store.
390
 
       branch3.repository._revision_store.total_size(
391
 
        branch3.repository.get_transaction())[1] / 1024,
392
400
       ), out)
393
401
        self.assertEqual('', err)
394
402
 
420
428
 
421
429
Branch history:
422
430
         1 revision
423
 
         1 committer
424
431
         0 days old
425
432
   first revision: %s
426
433
  latest revision: %s
427
434
 
428
435
Repository:
429
436
         1 revision
430
 
         %d KiB
431
437
""" % (branch4.repository._format.get_format_description(),
432
438
       datestring_first, datestring_first,
433
 
       # poking at _revision_store isn't all that clean, but neither is
434
 
       # having the ui test dependent on the exact overhead of a given store.
435
 
       branch4.repository._revision_store.total_size(
436
 
        branch4.repository.get_transaction())[1] / 1024,
437
439
       ), out)
438
440
        self.assertEqual('', err)
439
441
 
440
442
        # Out of date lightweight checkout
441
443
        out, err = self.run_bzr('info lightcheckout --verbose')
442
444
        self.assertEqualDiff(
443
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
445
"""Lightweight checkout (format: %s)
444
446
Location:
445
447
  light checkout root: lightcheckout
446
448
   checkout of branch: standalone
447
449
 
448
450
Format:
449
451
       control: Meta directory format 1
450
 
  working tree: Working tree format 4
 
452
  working tree: Working tree format 6
451
453
        branch: Branch format 4
452
454
    repository: Weave repository format 6
453
455
 
465
467
 
466
468
Branch history:
467
469
         2 revisions
468
 
         1 committer
469
470
         0 days old
470
471
   first revision: %s
471
472
  latest revision: %s
472
473
 
473
474
Repository:
474
475
         2 revisions
475
 
         0 KiB
476
 
""" % (datestring_first, datestring_last,), out)
 
476
""" % (self._repo_strings, datestring_first, datestring_last,), out)
477
477
        self.assertEqual('', err)
478
478
 
479
479
    def test_info_standalone_no_tree(self):
483
483
        repo = branch.repository
484
484
        out, err = self.run_bzr('info branch -v')
485
485
        self.assertEqualDiff(
486
 
"""Standalone branch (format: dirstate-tags)
 
486
"""Standalone branch (format: %s)
487
487
Location:
488
488
  branch root: branch
489
489
 
494
494
 
495
495
Branch history:
496
496
         0 revisions
497
 
         0 committers
498
497
 
499
498
Repository:
500
499
         0 revisions
501
 
         0 KiB
502
 
""" % (format.get_branch_format().get_format_description(),
 
500
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
 
501
       format.get_branch_format().get_format_description(),
503
502
       format.repository_format.get_format_description(),
504
503
       ), out)
505
504
        self.assertEqual('', err)
523
522
 
524
523
Repository:
525
524
         0 revisions
526
 
         0 KiB
527
525
""" % ('repo', format.repository_format.get_format_description(),
528
526
       ), out)
529
527
        self.assertEqual('', err)
546
544
 
547
545
Branch history:
548
546
         0 revisions
549
 
         0 committers
550
547
 
551
548
Repository:
552
549
         0 revisions
553
 
         0 KiB
554
550
""" % (format.get_branch_format().get_format_description(),
555
551
       format.repository_format.get_format_description(),
556
552
       ), out)
559
555
        # Create lightweight checkout
560
556
        transport.mkdir('tree')
561
557
        transport.mkdir('tree/lightcheckout')
562
 
        tree2 = branch1.create_checkout('tree/lightcheckout', 
 
558
        tree2 = branch1.create_checkout('tree/lightcheckout',
563
559
            lightweight=True)
564
560
        branch2 = tree2.branch
565
561
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
578
574
        datestring_first = format_date(rev.timestamp, rev.timezone)
579
575
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
580
576
        self.assertEqualDiff(
581
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
577
"""Lightweight checkout (format: %s)
582
578
Location:
583
579
  light checkout root: tree/lightcheckout
584
580
   checkout of branch: repo/branch
586
582
 
587
583
Format:
588
584
       control: Meta directory format 1
589
 
  working tree: Working tree format 4
 
585
  working tree: Working tree format 6
590
586
        branch: %s
591
587
    repository: %s
592
588
 
602
598
 
603
599
Branch history:
604
600
         1 revision
605
 
         1 committer
606
601
         0 days old
607
602
   first revision: %s
608
603
  latest revision: %s
609
604
 
610
605
Repository:
611
606
         1 revision
612
 
         %d KiB
613
 
""" % (format.get_branch_format().get_format_description(),
 
607
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
614
608
       format.repository_format.get_format_description(),
615
609
       datestring_first, datestring_first,
616
 
       # poking at _revision_store isn't all that clean, but neither is
617
 
       # having the ui test dependent on the exact overhead of a given store.
618
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
619
610
       ), out)
620
611
        self.assertEqual('', err)
621
612
 
622
613
        # Out of date checkout
623
614
        out, err = self.run_bzr('info -v tree/checkout')
624
615
        self.assertEqualDiff(
625
 
"""Checkout (format: dirstate)
 
616
"""Checkout (format: unnamed)
626
617
Location:
627
618
       checkout root: tree/checkout
628
619
  checkout of branch: repo/branch
629
620
 
630
621
Format:
631
622
       control: Meta directory format 1
632
 
  working tree: Working tree format 4
 
623
  working tree: Working tree format 6
633
624
        branch: %s
634
625
    repository: %s
635
626
 
647
638
 
648
639
Branch history:
649
640
         0 revisions
650
 
         0 committers
651
641
 
652
642
Repository:
653
643
         0 revisions
654
 
         0 KiB
655
644
""" % (format.get_branch_format().get_format_description(),
656
645
       format.repository_format.get_format_description(),
657
646
       ), out)
663
652
        tree3.add('b')
664
653
        out, err = self.run_bzr('info tree/checkout --verbose')
665
654
        self.assertEqualDiff(
666
 
"""Checkout (format: dirstate)
 
655
"""Checkout (format: unnamed)
667
656
Location:
668
657
       checkout root: tree/checkout
669
658
  checkout of branch: repo/branch
670
659
 
671
660
Format:
672
661
       control: Meta directory format 1
673
 
  working tree: Working tree format 4
 
662
  working tree: Working tree format 6
674
663
        branch: %s
675
664
    repository: %s
676
665
 
686
675
 
687
676
Branch history:
688
677
         1 revision
689
 
         1 committer
690
678
         0 days old
691
679
   first revision: %s
692
680
  latest revision: %s
693
681
 
694
682
Repository:
695
683
         1 revision
696
 
         %d KiB
697
684
""" % (format.get_branch_format().get_format_description(),
698
685
       format.repository_format.get_format_description(),
699
686
       datestring_first, datestring_first,
700
 
       # poking at _revision_store isn't all that clean, but neither is
701
 
       # having the ui test dependent on the exact overhead of a given store.
702
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
703
687
       ), out)
704
688
        self.assertEqual('', err)
705
689
        tree3.commit('commit two')
709
693
        datestring_last = format_date(rev.timestamp, rev.timezone)
710
694
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
711
695
        self.assertEqualDiff(
712
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
696
"""Lightweight checkout (format: %s)
713
697
Location:
714
698
  light checkout root: tree/lightcheckout
715
699
   checkout of branch: repo/branch
717
701
 
718
702
Format:
719
703
       control: Meta directory format 1
720
 
  working tree: Working tree format 4
 
704
  working tree: Working tree format 6
721
705
        branch: %s
722
706
    repository: %s
723
707
 
735
719
 
736
720
Branch history:
737
721
         2 revisions
738
 
         1 committer
739
722
         0 days old
740
723
   first revision: %s
741
724
  latest revision: %s
742
725
 
743
726
Repository:
744
727
         2 revisions
745
 
         %d KiB
746
 
""" % (format.get_branch_format().get_format_description(),
 
728
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
747
729
       format.repository_format.get_format_description(),
748
730
       datestring_first, datestring_last,
749
 
       # poking at _revision_store isn't all that clean, but neither is
750
 
       # having the ui test dependent on the exact overhead of a given store.
751
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
752
731
       ), out)
753
732
        self.assertEqual('', err)
754
733
 
767
746
 
768
747
Branch history:
769
748
         2 revisions
770
 
         1 committer
771
749
         0 days old
772
750
   first revision: %s
773
751
  latest revision: %s
774
752
 
775
753
Repository:
776
754
         2 revisions
777
 
         %d KiB
778
755
""" % (format.get_branch_format().get_format_description(),
779
756
       format.repository_format.get_format_description(),
780
757
       datestring_first, datestring_last,
781
 
       # poking at _revision_store isn't all that clean, but neither is
782
 
       # having the ui test dependent on the exact overhead of a given store.
783
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
784
758
       ), out)
785
759
        self.assertEqual('', err)
786
760
 
797
771
 
798
772
Repository:
799
773
         2 revisions
800
 
         %d KiB
801
774
""" % (format.repository_format.get_format_description(),
802
 
       # poking at _revision_store isn't all that clean, but neither is
803
 
       # having the ui test dependent on the exact overhead of a given store.
804
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
805
775
       ), out)
806
776
        self.assertEqual('', err)
807
777
 
826
796
 
827
797
Repository:
828
798
         0 revisions
829
 
         0 KiB
830
799
""" % (format.repository_format.get_format_description(),
831
800
       ), out)
832
801
        self.assertEqual('', err)
863
832
 
864
833
Branch history:
865
834
         0 revisions
866
 
         0 committers
867
835
 
868
836
Repository:
869
837
         0 revisions
870
 
         0 KiB
871
838
""" % (format.get_branch_format().get_format_description(),
872
839
       format.repository_format.get_format_description(),
873
840
       ), out)
905
872
 
906
873
Branch history:
907
874
         1 revision
908
 
         1 committer
909
875
         0 days old
910
876
   first revision: %s
911
877
  latest revision: %s
912
878
 
913
879
Repository:
914
880
         1 revision
915
 
         %d KiB
916
881
""" % (format.get_branch_format().get_format_description(),
917
882
       format.repository_format.get_format_description(),
918
883
       datestring_first, datestring_first,
919
 
       # poking at _revision_store isn't all that clean, but neither is
920
 
       # having the ui test dependent on the exact overhead of a given store.
921
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
922
884
       ), out)
923
885
        self.assertEqual('', err)
924
886
 
951
913
 
952
914
Branch history:
953
915
         0 revisions
954
 
         0 committers
955
916
 
956
917
Repository:
957
918
         1 revision
958
 
         %d KiB
959
919
""" % (format.get_branch_format().get_format_description(),
960
920
       format.repository_format.get_format_description(),
961
 
       # poking at _revision_store isn't all that clean, but neither is
962
 
       # having the ui test dependent on the exact overhead of a given store.
963
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
964
921
       ), out)
965
922
        self.assertEqual('', err)
966
923
 
995
952
 
996
953
Branch history:
997
954
         1 revision
998
 
         1 committer
999
955
         0 days old
1000
956
   first revision: %s
1001
957
  latest revision: %s
1002
958
 
1003
959
Repository:
1004
960
         1 revision
1005
 
         %d KiB
1006
961
""" % (format.get_branch_format().get_format_description(),
1007
962
       format.repository_format.get_format_description(),
1008
963
       datestring_first, datestring_first,
1009
 
       # poking at _revision_store isn't all that clean, but neither is
1010
 
       # having the ui test dependent on the exact overhead of a given store.
1011
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1012
964
       ), out)
1013
965
        self.assertEqual('', err)
1014
966
 
1027
979
 
1028
980
Repository:
1029
981
         1 revision
1030
 
         %d KiB
1031
982
""" % (format.repository_format.get_format_description(),
1032
 
       # poking at _revision_store isn't all that clean, but neither is
1033
 
       # having the ui test dependent on the exact overhead of a given store.
1034
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1035
983
       ),
1036
984
       out)
1037
985
        self.assertEqual('', err)
1038
 
    
 
986
 
1039
987
    def test_info_shared_repository_with_tree_in_root(self):
1040
988
        format = bzrdir.format_registry.make_bzrdir('knit')
1041
989
        transport = self.get_transport()
1057
1005
 
1058
1006
Repository:
1059
1007
         0 revisions
1060
 
         0 KiB
1061
1008
""" % (format.repository_format.get_format_description(),
1062
1009
       ), out)
1063
1010
        self.assertEqual('', err)
1091
1038
 
1092
1039
Branch history:
1093
1040
         0 revisions
1094
 
         0 committers
1095
1041
 
1096
1042
Repository:
1097
1043
         0 revisions
1098
 
         0 KiB
1099
1044
""" % (format.get_branch_format().get_format_description(),
1100
1045
       format.repository_format.get_format_description(),
1101
1046
       ), out)
1102
1047
        self.assertEqual('', err)
1103
1048
 
1104
 
    def assertCheckoutStatusOutput(self, 
 
1049
    def test_info_repository_hook(self):
 
1050
        format = bzrdir.format_registry.make_bzrdir('knit')
 
1051
        def repo_info(repo, stats, outf):
 
1052
            outf.write("more info\n")
 
1053
        info.hooks.install_named_hook('repository', repo_info, None)
 
1054
        # Create shared repository with working trees
 
1055
        repo = self.make_repository('repo', shared=True, format=format)
 
1056
        out, err = self.run_bzr('info -v repo')
 
1057
        self.assertEqualDiff(
 
1058
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
1059
Location:
 
1060
  shared repository: repo
 
1061
 
 
1062
Format:
 
1063
       control: Meta directory format 1
 
1064
    repository: %s
 
1065
 
 
1066
Create working tree for new branches inside the repository.
 
1067
 
 
1068
Repository:
 
1069
         0 revisions
 
1070
more info
 
1071
""" % (format.repository_format.get_format_description(),
 
1072
       ), out)
 
1073
        self.assertEqual('', err)
 
1074
 
 
1075
    def assertCheckoutStatusOutput(self,
1105
1076
        command_string, lco_tree, shared_repo=None,
1106
1077
        repo_branch=None,
1107
1078
        tree_locked=False,
1116
1087
        allow us, the test writers, to document what *should* be present in
1117
1088
        the output. Removing this separation would remove the value of the
1118
1089
        tests.
1119
 
        
 
1090
 
1120
1091
        :param path: the path to the light checkout.
1121
1092
        :param lco_tree: the tree object for the light checkout.
1122
1093
        :param shared_repo: A shared repository is in use, expect that in
1126
1097
        :param tree_locked: If true, expect the tree to be locked.
1127
1098
        :param branch_locked: If true, expect the branch to be locked.
1128
1099
        :param repo_locked: If true, expect the repository to be locked.
1129
 
        :param verbose: If true, expect verbose output
 
1100
            Note that the lco_tree.branch.repository is inspected, and if is not
 
1101
            actually locked then this parameter is overridden. This is because
 
1102
            pack repositories do not have any public API for obtaining an
 
1103
            exclusive repository wide lock.
 
1104
        :param verbose: verbosity level: 2 or higher to show committers
1130
1105
        """
1131
1106
        def friendly_location(url):
1132
1107
            path = urlutils.unescape_for_display(url, 'ascii')
1133
1108
            try:
1134
 
                return osutils.relpath(os.getcwd(), path)
 
1109
                return osutils.relpath(osutils.getcwd(), path)
1135
1110
            except errors.PathNotChild:
1136
1111
                return path
1137
1112
 
1138
 
        if tree_locked and sys.platform == 'win32':
1139
 
            # We expect this to fail because of locking errors. (A write-locked
1140
 
            # file cannot be read-locked in the same process).
 
1113
        if tree_locked:
 
1114
            # We expect this to fail because of locking errors.
 
1115
            # (A write-locked file cannot be read-locked
 
1116
            # in the different process -- either on win32 or on linux).
1141
1117
            # This should be removed when the locking errors are fixed.
1142
 
            args = command_string.split(' ')
1143
 
            self.run_bzr_error([], 'info', *args)
1144
 
            return
 
1118
            self.expectFailure('OS locks are exclusive '
 
1119
                'for different processes (Bug #174055)',
 
1120
                self.run_bzr_subprocess,
 
1121
                'info ' + command_string)
1145
1122
        out, err = self.run_bzr('info %s' % command_string)
1146
1123
        description = {
1147
1124
            (True, True): 'Lightweight checkout',
1149
1126
            (False, True): 'Lightweight checkout',
1150
1127
            (False, False): 'Checkout',
1151
1128
            }[(shared_repo is not None, light_checkout)]
1152
 
        format = {True: 'dirstate or dirstate-tags',
1153
 
                  False: 'dirstate'}[light_checkout]
 
1129
        format = {True: self._repo_strings,
 
1130
                  False: 'unnamed'}[light_checkout]
 
1131
        if repo_locked:
 
1132
            repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1154
1133
        if repo_locked or branch_locked or tree_locked:
1155
1134
            def locked_message(a_bool):
1156
1135
                if a_bool:
1191
1170
        else:
1192
1171
            branch_data = ("   checkout of branch: %s\n" %
1193
1172
                lco_tree.branch.bzrdir.root_transport.base)
1194
 
        
1195
 
        if verbose:
 
1173
 
 
1174
        if verbose >= 2:
1196
1175
            verbose_info = '         0 committers\n'
1197
1176
        else:
1198
1177
            verbose_info = ''
1199
 
            
 
1178
 
1200
1179
        self.assertEqualDiff(
1201
1180
"""%s (format: %s)
1202
1181
Location:
1222
1201
%s
1223
1202
Repository:
1224
1203
         0 revisions
1225
 
         0 KiB
1226
1204
""" %  (description,
1227
1205
        format,
1228
1206
        tree_data,
1239
1217
        transport = self.get_transport()
1240
1218
        # Create shared repository with a branch
1241
1219
        repo = self.make_repository('repo', shared=True,
1242
 
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1220
                                    format=bzrdir.BzrDirMetaFormat1())
1243
1221
        repo.set_make_working_trees(False)
1244
1222
        repo.bzrdir.root_transport.mkdir('branch')
1245
1223
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1246
 
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1224
                                    format=bzrdir.BzrDirMetaFormat1())
1247
1225
        # Do a heavy checkout
1248
1226
        transport.mkdir('tree')
1249
1227
        transport.mkdir('tree/checkout')
1250
 
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1251
 
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1228
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1229
            format=bzrdir.BzrDirMetaFormat1())
1252
1230
        co_branch.bind(repo_branch)
1253
1231
        # Do a light checkout of the heavy one
1254
1232
        transport.mkdir('tree/lightcheckout')
1255
 
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1256
 
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
 
1233
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1234
        branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1257
1235
        lco_dir.create_workingtree()
1258
1236
        lco_tree = lco_dir.open_workingtree()
1259
1237
 
1350
1328
    def test_info_locking_oslocks(self):
1351
1329
        if sys.platform == "win32":
1352
1330
            raise TestSkipped("don't use oslocks on win32 in unix manner")
 
1331
        self.thisFailsStrictLockCheck()
1353
1332
 
1354
1333
        tree = self.make_branch_and_tree('branch',
1355
 
                                         format=bzrlib.bzrdir.BzrDirFormat6())
 
1334
                                         format=bzrdir.BzrDirFormat6())
1356
1335
 
1357
1336
        # Test all permutations of locking the working tree, branch and repository
1358
1337
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1385
1364
 
1386
1365
Branch history:
1387
1366
         0 revisions
1388
 
         0 committers
1389
1367
 
1390
1368
Repository:
1391
1369
         0 revisions
1392
 
         0 KiB
1393
1370
""" % ('branch', tree.branch.repository._format.get_format_description(),
1394
1371
       ), out)
1395
1372
        self.assertEqual('', err)
1419
1396
 
1420
1397
Branch history:
1421
1398
         0 revisions
1422
 
         0 committers
1423
1399
 
1424
1400
Repository:
1425
1401
         0 revisions
1426
 
         0 KiB
1427
1402
""" % ('branch', tree.branch.repository._format.get_format_description(),
1428
1403
       ), out)
1429
1404
        self.assertEqual('', err)
1430
1405
        tree.unlock()
 
1406
 
 
1407
    def test_info_stacked(self):
 
1408
        # We have a mainline
 
1409
        trunk_tree = self.make_branch_and_tree('mainline',
 
1410
            format='1.6')
 
1411
        trunk_tree.commit('mainline')
 
1412
        # and a branch from it which is stacked
 
1413
        new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
 
1414
        out, err = self.run_bzr('info newbranch')
 
1415
        self.assertEqual(
 
1416
"""Standalone tree (format: 1.6)
 
1417
Location:
 
1418
  branch root: newbranch
 
1419
 
 
1420
Related branches:
 
1421
  parent branch: mainline
 
1422
     stacked on: mainline
 
1423
""", out)
 
1424
        self.assertEqual("", err)