~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-01-03 18:09:01 UTC
  • mfrom: (3159.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20080103180901-w987y1ftqoh02qbm
(vila) Fix #179368 by keeping the current range hint on
        ShortReadvErrors

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for the info command of bzr."""
19
19
 
 
20
import os
20
21
import sys
21
22
 
22
23
import bzrlib
23
24
from bzrlib import (
24
25
    bzrdir,
 
26
    errors,
 
27
    info,
 
28
    osutils,
25
29
    repository,
 
30
    urlutils,
26
31
    )
27
32
from bzrlib.osutils import format_date
28
33
from bzrlib.tests import TestSkipped
36
41
            location = "C:/i/do/not/exist/"
37
42
        else:
38
43
            location = "/i/do/not/exist/"
39
 
        out, err = self.runbzr('info '+location, retcode=3)
 
44
        out, err = self.run_bzr('info '+location, retcode=3)
40
45
        self.assertEqual(out, '')
41
 
        self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
 
46
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
42
47
 
43
48
    def test_info_standalone(self):
44
49
        transport = self.get_transport()
48
53
        self.build_tree(['standalone/a'])
49
54
        tree1.add('a')
50
55
        branch1 = tree1.branch
51
 
        out, err = self.runbzr('info standalone -v')
52
 
        self.assertEqualDiff(
53
 
"""Standalone tree (format: weave)
54
 
Location:
55
 
  branch root: %s
 
56
 
 
57
        out, err = self.run_bzr('info standalone')
 
58
        self.assertEqualDiff(
 
59
"""Standalone tree (format: weave)
 
60
Location:
 
61
  branch root: standalone
 
62
""", out)
 
63
        self.assertEqual('', err)
 
64
 
 
65
        out, err = self.run_bzr('info standalone -v')
 
66
        self.assertEqualDiff(
 
67
"""Standalone tree (format: weave)
 
68
Location:
 
69
  branch root: standalone
56
70
 
57
71
Format:
58
72
       control: All-in-one format 6
77
91
Repository:
78
92
         0 revisions
79
93
         0 KiB
80
 
""" % branch1.bzrdir.root_transport.base, out)
 
94
""", out)
81
95
        self.assertEqual('', err)
82
96
        tree1.commit('commit one')
83
97
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
86
100
        # Branch standalone with push location
87
101
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
88
102
        branch2.set_push_location(branch1.bzrdir.root_transport.base)
89
 
        out, err = self.runbzr('info branch --verbose')
90
 
        self.assertEqualDiff(
91
 
"""Standalone tree (format: weave)
92
 
Location:
93
 
  branch root: %s
94
 
 
95
 
Related branches:
96
 
      parent branch: %s
97
 
  publish to branch: %s
 
103
 
 
104
        out, err = self.run_bzr('info branch')
 
105
        self.assertEqualDiff(
 
106
"""Standalone tree (format: weave)
 
107
Location:
 
108
  branch root: branch
 
109
 
 
110
Related branches:
 
111
    push branch: standalone
 
112
  parent branch: standalone
 
113
""", out)
 
114
        self.assertEqual('', err)
 
115
 
 
116
        out, err = self.run_bzr('info branch --verbose')
 
117
        self.assertEqualDiff(
 
118
"""Standalone tree (format: weave)
 
119
Location:
 
120
  branch root: branch
 
121
 
 
122
Related branches:
 
123
    push branch: standalone
 
124
  parent branch: standalone
98
125
 
99
126
Format:
100
127
       control: All-in-one format 6
122
149
Repository:
123
150
         1 revision
124
151
         %d KiB
125
 
""" % (branch2.bzrdir.root_transport.base,
126
 
       branch1.bzrdir.root_transport.base,
127
 
       branch1.bzrdir.root_transport.base,
128
 
       datestring_first, datestring_first,
 
152
""" % (datestring_first, datestring_first,
129
153
       # poking at _revision_store isn't all that clean, but neither is
130
154
       # having the ui test dependent on the exact overhead of a given store.
131
155
       branch2.repository._revision_store.total_size(
141
165
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
142
166
        branch3.bind(branch1)
143
167
        bound_tree = branch3.bzrdir.open_workingtree()
144
 
        out, err = self.runbzr('info -v bound')
 
168
        out, err = self.run_bzr('info -v bound')
145
169
        self.assertEqualDiff(
146
170
"""Checkout (format: knit)
147
171
Location:
148
 
       checkout root: %s
149
 
  checkout of branch: %s
 
172
       checkout root: bound
 
173
  checkout of branch: standalone
150
174
 
151
175
Related branches:
152
 
  parent branch: %s
 
176
  parent branch: standalone
153
177
 
154
178
Format:
155
179
       control: Meta directory format 1
177
201
Repository:
178
202
         1 revision
179
203
         %d KiB
180
 
""" % (branch3.bzrdir.root_transport.base,
181
 
       branch1.bzrdir.root_transport.base,
182
 
       branch1.bzrdir.root_transport.base,
183
 
       bound_tree._format.get_format_description(),      
 
204
""" % (bound_tree._format.get_format_description(),
184
205
       branch3._format.get_format_description(),
185
206
       branch3.repository._format.get_format_description(),
186
207
       datestring_first, datestring_first,
196
217
            format=knit1_format)
197
218
        branch4.bind(branch1)
198
219
        branch4.bzrdir.open_workingtree().update()
199
 
        out, err = self.runbzr('info checkout --verbose')
 
220
        out, err = self.run_bzr('info checkout --verbose')
200
221
        self.assertEqualDiff(
201
222
"""Checkout (format: knit)
202
223
Location:
203
 
       checkout root: %s
204
 
  checkout of branch: %s
 
224
       checkout root: checkout
 
225
  checkout of branch: standalone
205
226
 
206
227
Format:
207
228
       control: Meta directory format 1
229
250
Repository:
230
251
         1 revision
231
252
         %d KiB
232
 
""" % (branch4.bzrdir.root_transport.base,
233
 
       branch1.bzrdir.root_transport.base,
234
 
       branch4.repository._format.get_format_description(),
 
253
""" % (branch4.repository._format.get_format_description(),
235
254
       datestring_first, datestring_first,
236
255
       # poking at _revision_store isn't all that clean, but neither is
237
256
       # having the ui test dependent on the exact overhead of a given store.
243
262
        # Lightweight checkout (same as above, different branch and repository)
244
263
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
245
264
        branch5 = tree5.branch
246
 
        out, err = self.runbzr('info -v lightcheckout')
 
265
        out, err = self.run_bzr('info -v lightcheckout')
247
266
        self.assertEqualDiff(
248
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
267
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
268
pack-0.92 or rich-root or rich-root-pack)
249
269
Location:
250
 
  light checkout root: %s
251
 
   checkout of branch: %s
 
270
  light checkout root: lightcheckout
 
271
   checkout of branch: standalone
252
272
 
253
273
Format:
254
274
       control: Meta directory format 1
276
296
Repository:
277
297
         1 revision
278
298
         0 KiB
279
 
""" % (tree5.bzrdir.root_transport.base,
280
 
       branch1.bzrdir.root_transport.base,
281
 
       datestring_first, datestring_first,
282
 
       ), out)
 
299
""" % (datestring_first, datestring_first,), out)
283
300
        self.assertEqual('', err)
284
301
 
285
302
        # Update initial standalone branch
290
307
        datestring_last = format_date(rev.timestamp, rev.timezone)
291
308
 
292
309
        # Out of date branched standalone branch will not be detected
293
 
        out, err = self.runbzr('info -v branch')
 
310
        out, err = self.run_bzr('info -v branch')
294
311
        self.assertEqualDiff(
295
312
"""Standalone tree (format: weave)
296
313
Location:
297
 
  branch root: %s
 
314
  branch root: branch
298
315
 
299
316
Related branches:
300
 
      parent branch: %s
301
 
  publish to branch: %s
 
317
    push branch: standalone
 
318
  parent branch: standalone
302
319
 
303
320
Format:
304
321
       control: All-in-one format 6
326
343
Repository:
327
344
         1 revision
328
345
         0 KiB
329
 
""" % (branch2.bzrdir.root_transport.base,
330
 
       branch1.bzrdir.root_transport.base,
331
 
       branch1.bzrdir.root_transport.base,
332
 
       datestring_first, datestring_first,
 
346
""" % (datestring_first, datestring_first,
333
347
       ), out)
334
348
        self.assertEqual('', err)
335
349
 
336
350
        # Out of date bound branch
337
 
        out, err = self.runbzr('info -v bound')
 
351
        out, err = self.run_bzr('info -v bound')
338
352
        self.assertEqualDiff(
339
353
"""Checkout (format: knit)
340
354
Location:
341
 
       checkout root: %s
342
 
  checkout of branch: %s
 
355
       checkout root: bound
 
356
  checkout of branch: standalone
343
357
 
344
358
Related branches:
345
 
  parent branch: %s
 
359
  parent branch: standalone
346
360
 
347
361
Format:
348
362
       control: Meta directory format 1
372
386
Repository:
373
387
         1 revision
374
388
         %d KiB
375
 
""" % (branch3.bzrdir.root_transport.base,
376
 
       branch1.bzrdir.root_transport.base,
377
 
       branch1.bzrdir.root_transport.base,
378
 
       branch3.repository._format.get_format_description(),
 
389
""" % (branch3.repository._format.get_format_description(),
379
390
       datestring_first, datestring_first,
380
391
       # poking at _revision_store isn't all that clean, but neither is
381
392
       # having the ui test dependent on the exact overhead of a given store.
385
396
        self.assertEqual('', err)
386
397
 
387
398
        # Out of date checkout
388
 
        out, err = self.runbzr('info -v checkout')
 
399
        out, err = self.run_bzr('info -v checkout')
389
400
        self.assertEqualDiff(
390
401
"""Checkout (format: knit)
391
402
Location:
392
 
       checkout root: %s
393
 
  checkout of branch: %s
 
403
       checkout root: checkout
 
404
  checkout of branch: standalone
394
405
 
395
406
Format:
396
407
       control: Meta directory format 1
420
431
Repository:
421
432
         1 revision
422
433
         %d KiB
423
 
""" % (branch4.bzrdir.root_transport.base,
424
 
       branch1.bzrdir.root_transport.base,
425
 
       branch4.repository._format.get_format_description(),
 
434
""" % (branch4.repository._format.get_format_description(),
426
435
       datestring_first, datestring_first,
427
436
       # poking at _revision_store isn't all that clean, but neither is
428
437
       # having the ui test dependent on the exact overhead of a given store.
432
441
        self.assertEqual('', err)
433
442
 
434
443
        # Out of date lightweight checkout
435
 
        out, err = self.runbzr('info lightcheckout --verbose')
 
444
        out, err = self.run_bzr('info lightcheckout --verbose')
436
445
        self.assertEqualDiff(
437
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
446
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
447
pack-0.92 or rich-root or rich-root-pack)
438
448
Location:
439
 
  light checkout root: %s
440
 
   checkout of branch: %s
 
449
  light checkout root: lightcheckout
 
450
   checkout of branch: standalone
441
451
 
442
452
Format:
443
453
       control: Meta directory format 1
467
477
Repository:
468
478
         2 revisions
469
479
         0 KiB
470
 
""" % (tree5.bzrdir.root_transport.base,
471
 
       branch1.bzrdir.root_transport.base,
472
 
       datestring_first, datestring_last,
473
 
       ), out)
 
480
""" % (datestring_first, datestring_last,), out)
474
481
        self.assertEqual('', err)
475
482
 
476
483
    def test_info_standalone_no_tree(self):
478
485
        format = bzrdir.format_registry.make_bzrdir('default')
479
486
        branch = self.make_branch('branch')
480
487
        repo = branch.repository
481
 
        out, err = self.runbzr('info branch -v')
 
488
        out, err = self.run_bzr('info branch -v')
482
489
        self.assertEqualDiff(
483
 
"""Standalone branch (format: dirstate or knit)
 
490
"""Standalone branch (format: %s)
484
491
Location:
485
 
  branch root: %s
 
492
  branch root: branch
486
493
 
487
494
Format:
488
495
       control: Meta directory format 1
496
503
Repository:
497
504
         0 revisions
498
505
         0 KiB
499
 
""" % (branch.bzrdir.root_transport.base,
 
506
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
500
507
       format.get_branch_format().get_format_description(),
501
508
       format.repository_format.get_format_description(),
502
509
       ), out)
509
516
        # Create shared repository
510
517
        repo = self.make_repository('repo', shared=True, format=format)
511
518
        repo.set_make_working_trees(False)
512
 
        out, err = self.runbzr('info -v repo')
 
519
        out, err = self.run_bzr('info -v repo')
513
520
        self.assertEqualDiff(
514
521
"""Shared repository (format: dirstate or dirstate-tags or knit)
515
522
Location:
522
529
Repository:
523
530
         0 revisions
524
531
         0 KiB
525
 
""" % (repo.bzrdir.root_transport.base,
526
 
       format.repository_format.get_format_description(),
 
532
""" % ('repo', format.repository_format.get_format_description(),
527
533
       ), out)
528
534
        self.assertEqual('', err)
529
535
 
531
537
        repo.bzrdir.root_transport.mkdir('branch')
532
538
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
533
539
            format=format)
534
 
        out, err = self.runbzr('info -v repo/branch')
 
540
        out, err = self.run_bzr('info -v repo/branch')
535
541
        self.assertEqualDiff(
536
542
"""Repository branch (format: dirstate or knit)
537
543
Location:
538
 
  shared repository: %s
539
 
  repository branch: branch
 
544
  shared repository: repo
 
545
  repository branch: repo/branch
540
546
 
541
547
Format:
542
548
       control: Meta directory format 1
550
556
Repository:
551
557
         0 revisions
552
558
         0 KiB
553
 
""" % (repo.bzrdir.root_transport.base,
554
 
       format.get_branch_format().get_format_description(),
 
559
""" % (format.get_branch_format().get_format_description(),
555
560
       format.repository_format.get_format_description(),
556
561
       ), out)
557
562
        self.assertEqual('', err)
576
581
        tree2.commit('commit one')
577
582
        rev = repo.get_revision(branch2.revision_history()[0])
578
583
        datestring_first = format_date(rev.timestamp, rev.timezone)
579
 
        out, err = self.runbzr('info tree/lightcheckout --verbose')
 
584
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
580
585
        self.assertEqualDiff(
581
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
586
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
587
pack-0.92 or rich-root or rich-root-pack)
582
588
Location:
583
 
  light checkout root: %s
584
 
   checkout of branch: %s
585
 
    shared repository: %s
 
589
  light checkout root: tree/lightcheckout
 
590
   checkout of branch: repo/branch
 
591
    shared repository: repo
586
592
 
587
593
Format:
588
594
       control: Meta directory format 1
610
616
Repository:
611
617
         1 revision
612
618
         %d KiB
613
 
""" % (tree2.bzrdir.root_transport.base,
614
 
       tree2.branch.bzrdir.root_transport.base,
615
 
       repo.bzrdir.root_transport.base,
616
 
       format.get_branch_format().get_format_description(),
 
619
""" % (format.get_branch_format().get_format_description(),
617
620
       format.repository_format.get_format_description(),
618
621
       datestring_first, datestring_first,
619
622
       # poking at _revision_store isn't all that clean, but neither is
623
626
        self.assertEqual('', err)
624
627
 
625
628
        # Out of date checkout
626
 
        out, err = self.runbzr('info -v tree/checkout')
 
629
        out, err = self.run_bzr('info -v tree/checkout')
627
630
        self.assertEqualDiff(
628
631
"""Checkout (format: dirstate)
629
632
Location:
630
 
       checkout root: %s
631
 
  checkout of branch: %s
 
633
       checkout root: tree/checkout
 
634
  checkout of branch: repo/branch
632
635
 
633
636
Format:
634
637
       control: Meta directory format 1
655
658
Repository:
656
659
         0 revisions
657
660
         0 KiB
658
 
""" % (tree3.bzrdir.root_transport.base,
659
 
       branch1.bzrdir.root_transport.base,
660
 
       format.get_branch_format().get_format_description(),
 
661
""" % (format.get_branch_format().get_format_description(),
661
662
       format.repository_format.get_format_description(),
662
663
       ), out)
663
664
        self.assertEqual('', err)
666
667
        tree3.update()
667
668
        self.build_tree(['tree/checkout/b'])
668
669
        tree3.add('b')
669
 
        out, err = self.runbzr('info tree/checkout --verbose')
 
670
        out, err = self.run_bzr('info tree/checkout --verbose')
670
671
        self.assertEqualDiff(
671
672
"""Checkout (format: dirstate)
672
673
Location:
673
 
       checkout root: %s
674
 
  checkout of branch: %s
 
674
       checkout root: tree/checkout
 
675
  checkout of branch: repo/branch
675
676
 
676
677
Format:
677
678
       control: Meta directory format 1
699
700
Repository:
700
701
         1 revision
701
702
         %d KiB
702
 
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
703
 
       format.get_branch_format().get_format_description(),
 
703
""" % (format.get_branch_format().get_format_description(),
704
704
       format.repository_format.get_format_description(),
705
705
       datestring_first, datestring_first,
706
706
       # poking at _revision_store isn't all that clean, but neither is
713
713
        # Out of date lightweight checkout
714
714
        rev = repo.get_revision(branch1.revision_history()[-1])
715
715
        datestring_last = format_date(rev.timestamp, rev.timezone)
716
 
        out, err = self.runbzr('info tree/lightcheckout --verbose')
 
716
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
717
717
        self.assertEqualDiff(
718
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
718
"""Lightweight checkout (format: dirstate or dirstate-tags or \
 
719
pack-0.92 or rich-root or rich-root-pack)
719
720
Location:
720
 
  light checkout root: %s
721
 
   checkout of branch: %s
722
 
    shared repository: %s
 
721
  light checkout root: tree/lightcheckout
 
722
   checkout of branch: repo/branch
 
723
    shared repository: repo
723
724
 
724
725
Format:
725
726
       control: Meta directory format 1
749
750
Repository:
750
751
         2 revisions
751
752
         %d KiB
752
 
""" % (tree2.bzrdir.root_transport.base,
753
 
       tree2.branch.bzrdir.root_transport.base,
754
 
       repo.bzrdir.root_transport.base,
755
 
       format.get_branch_format().get_format_description(),
 
753
""" % (format.get_branch_format().get_format_description(),
756
754
       format.repository_format.get_format_description(),
757
755
       datestring_first, datestring_last,
758
756
       # poking at _revision_store isn't all that clean, but neither is
762
760
        self.assertEqual('', err)
763
761
 
764
762
        # Show info about shared branch
765
 
        out, err = self.runbzr('info repo/branch --verbose')
 
763
        out, err = self.run_bzr('info repo/branch --verbose')
766
764
        self.assertEqualDiff(
767
765
"""Repository branch (format: dirstate or knit)
768
766
Location:
769
 
  shared repository: %s
770
 
  repository branch: branch
 
767
  shared repository: repo
 
768
  repository branch: repo/branch
771
769
 
772
770
Format:
773
771
       control: Meta directory format 1
784
782
Repository:
785
783
         2 revisions
786
784
         %d KiB
787
 
""" % (repo.bzrdir.root_transport.base,
788
 
       format.get_branch_format().get_format_description(),
 
785
""" % (format.get_branch_format().get_format_description(),
789
786
       format.repository_format.get_format_description(),
790
787
       datestring_first, datestring_last,
791
788
       # poking at _revision_store isn't all that clean, but neither is
795
792
        self.assertEqual('', err)
796
793
 
797
794
        # Show info about repository with revisions
798
 
        out, err = self.runbzr('info -v repo')
 
795
        out, err = self.run_bzr('info -v repo')
799
796
        self.assertEqualDiff(
800
797
"""Shared repository (format: dirstate or dirstate-tags or knit)
801
798
Location:
802
 
  shared repository: %s
 
799
  shared repository: repo
803
800
 
804
801
Format:
805
802
       control: Meta directory format 1
808
805
Repository:
809
806
         2 revisions
810
807
         %d KiB
811
 
""" % (repo.bzrdir.root_transport.base,
812
 
       format.repository_format.get_format_description(),
 
808
""" % (format.repository_format.get_format_description(),
813
809
       # poking at _revision_store isn't all that clean, but neither is
814
810
       # having the ui test dependent on the exact overhead of a given store.
815
811
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
823
819
        # Create shared repository with working trees
824
820
        repo = self.make_repository('repo', shared=True, format=format)
825
821
        repo.set_make_working_trees(True)
826
 
        out, err = self.runbzr('info -v repo')
 
822
        out, err = self.run_bzr('info -v repo')
827
823
        self.assertEqualDiff(
828
824
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
829
825
Location:
830
 
  shared repository: %s
 
826
  shared repository: repo
831
827
 
832
828
Format:
833
829
       control: Meta directory format 1
838
834
Repository:
839
835
         0 revisions
840
836
         0 KiB
841
 
""" % (repo.bzrdir.root_transport.base,
842
 
       format.repository_format.get_format_description(),
 
837
""" % (format.repository_format.get_format_description(),
843
838
       ), out)
844
839
        self.assertEqual('', err)
845
840
 
850
845
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
851
846
 
852
847
        # Empty first branch
853
 
        out, err = self.runbzr('info repo/branch1 --verbose')
 
848
        out, err = self.run_bzr('info repo/branch1 --verbose')
854
849
        self.assertEqualDiff(
855
850
"""Repository tree (format: knit)
856
851
Location:
857
 
  shared repository: %s
858
 
  repository branch: branch1
 
852
  shared repository: repo
 
853
  repository branch: repo/branch1
859
854
 
860
855
Format:
861
856
       control: Meta directory format 1
880
875
Repository:
881
876
         0 revisions
882
877
         0 KiB
883
 
""" % (repo.bzrdir.root_transport.base,
884
 
       format.get_branch_format().get_format_description(),
 
878
""" % (format.get_branch_format().get_format_description(),
885
879
       format.repository_format.get_format_description(),
886
880
       ), out)
887
881
        self.assertEqual('', err)
893
887
        tree1.commit('commit one')
894
888
        rev = repo.get_revision(branch1.revision_history()[0])
895
889
        datestring_first = format_date(rev.timestamp, rev.timezone)
896
 
        out, err = self.runbzr('info -v repo/branch1')
 
890
        out, err = self.run_bzr('info -v repo/branch1')
897
891
        self.assertEqualDiff(
898
892
"""Repository tree (format: knit)
899
893
Location:
900
 
  shared repository: %s
901
 
  repository branch: branch1
 
894
  shared repository: repo
 
895
  repository branch: repo/branch1
902
896
 
903
897
Format:
904
898
       control: Meta directory format 1
926
920
Repository:
927
921
         1 revision
928
922
         %d KiB
929
 
""" % (repo.bzrdir.root_transport.base,
930
 
       format.get_branch_format().get_format_description(),
 
923
""" % (format.get_branch_format().get_format_description(),
931
924
       format.repository_format.get_format_description(),
932
925
       datestring_first, datestring_first,
933
926
       # poking at _revision_store isn't all that clean, but neither is
937
930
        self.assertEqual('', err)
938
931
 
939
932
        # Out of date second branch
940
 
        out, err = self.runbzr('info repo/branch2 --verbose')
 
933
        out, err = self.run_bzr('info repo/branch2 --verbose')
941
934
        self.assertEqualDiff(
942
935
"""Repository tree (format: knit)
943
936
Location:
944
 
  shared repository: %s
945
 
  repository branch: branch2
 
937
  shared repository: repo
 
938
  repository branch: repo/branch2
946
939
 
947
940
Related branches:
948
 
  parent branch: %s
 
941
  parent branch: repo/branch1
949
942
 
950
943
Format:
951
944
       control: Meta directory format 1
970
963
Repository:
971
964
         1 revision
972
965
         %d KiB
973
 
""" % (repo.bzrdir.root_transport.base,
974
 
       branch1.bzrdir.root_transport.base,
975
 
       format.get_branch_format().get_format_description(),
 
966
""" % (format.get_branch_format().get_format_description(),
976
967
       format.repository_format.get_format_description(),
977
968
       # poking at _revision_store isn't all that clean, but neither is
978
969
       # having the ui test dependent on the exact overhead of a given store.
983
974
        # Update second branch
984
975
        tree2 = branch2.bzrdir.open_workingtree()
985
976
        tree2.pull(branch1)
986
 
        out, err = self.runbzr('info -v repo/branch2')
 
977
        out, err = self.run_bzr('info -v repo/branch2')
987
978
        self.assertEqualDiff(
988
979
"""Repository tree (format: knit)
989
980
Location:
990
 
  shared repository: %s
991
 
  repository branch: branch2
 
981
  shared repository: repo
 
982
  repository branch: repo/branch2
992
983
 
993
984
Related branches:
994
 
  parent branch: %s
 
985
  parent branch: repo/branch1
995
986
 
996
987
Format:
997
988
       control: Meta directory format 1
1019
1010
Repository:
1020
1011
         1 revision
1021
1012
         %d KiB
1022
 
""" % (repo.bzrdir.root_transport.base,
1023
 
       branch1.bzrdir.root_transport.base,
1024
 
       format.get_branch_format().get_format_description(),
 
1013
""" % (format.get_branch_format().get_format_description(),
1025
1014
       format.repository_format.get_format_description(),
1026
1015
       datestring_first, datestring_first,
1027
1016
       # poking at _revision_store isn't all that clean, but neither is
1031
1020
        self.assertEqual('', err)
1032
1021
 
1033
1022
        # Show info about repository with revisions
1034
 
        out, err = self.runbzr('info -v repo')
 
1023
        out, err = self.run_bzr('info -v repo')
1035
1024
        self.assertEqualDiff(
1036
1025
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1037
1026
Location:
1038
 
  shared repository: %s
 
1027
  shared repository: repo
1039
1028
 
1040
1029
Format:
1041
1030
       control: Meta directory format 1
1046
1035
Repository:
1047
1036
         1 revision
1048
1037
         %d KiB
1049
 
""" % (repo.bzrdir.root_transport.base,
1050
 
       format.repository_format.get_format_description(),
 
1038
""" % (format.repository_format.get_format_description(),
1051
1039
       # poking at _revision_store isn't all that clean, but neither is
1052
1040
       # having the ui test dependent on the exact overhead of a given store.
1053
1041
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1062
1050
        # Create shared repository with working trees
1063
1051
        repo = self.make_repository('repo', shared=True, format=format)
1064
1052
        repo.set_make_working_trees(True)
1065
 
        out, err = self.runbzr('info -v repo')
 
1053
        out, err = self.run_bzr('info -v repo')
1066
1054
        self.assertEqualDiff(
1067
1055
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1068
1056
Location:
1069
 
  shared repository: %s
 
1057
  shared repository: repo
1070
1058
 
1071
1059
Format:
1072
1060
       control: Meta directory format 1
1077
1065
Repository:
1078
1066
         0 revisions
1079
1067
         0 KiB
1080
 
""" % (repo.bzrdir.root_transport.base,
1081
 
       format.repository_format.get_format_description(),
 
1068
""" % (format.repository_format.get_format_description(),
1082
1069
       ), out)
1083
1070
        self.assertEqual('', err)
1084
1071
 
1086
1073
        control = repo.bzrdir
1087
1074
        branch = control.create_branch()
1088
1075
        control.create_workingtree()
1089
 
        out, err = self.runbzr('info -v repo')
 
1076
        out, err = self.run_bzr('info -v repo')
1090
1077
        self.assertEqualDiff(
1091
1078
"""Repository tree (format: knit)
1092
1079
Location:
1093
 
  shared repository: %s
1094
 
  repository branch: .
 
1080
  shared repository: repo
 
1081
  repository branch: repo
1095
1082
 
1096
1083
Format:
1097
1084
       control: Meta directory format 1
1116
1103
Repository:
1117
1104
         0 revisions
1118
1105
         0 KiB
1119
 
""" % (repo.bzrdir.root_transport.base,
1120
 
       format.get_branch_format().get_format_description(),
 
1106
""" % (format.get_branch_format().get_format_description(),
1121
1107
       format.repository_format.get_format_description(),
1122
1108
       ), out)
1123
1109
        self.assertEqual('', err)
1124
1110
 
1125
 
    def assertCheckoutStatusOutput(self, 
 
1111
    def assertCheckoutStatusOutput(self,
1126
1112
        command_string, lco_tree, shared_repo=None,
1127
1113
        repo_branch=None,
1128
1114
        tree_locked=False,
1147
1133
        :param tree_locked: If true, expect the tree to be locked.
1148
1134
        :param branch_locked: If true, expect the branch to be locked.
1149
1135
        :param repo_locked: If true, expect the repository to be locked.
 
1136
            Note that the lco_tree.branch.repository is inspected, and if is not
 
1137
            actually locked then this parameter is overridden. This is because
 
1138
            pack repositories do not have any public API for obtaining an
 
1139
            exclusive repository wide lock.
1150
1140
        :param verbose: If true, expect verbose output
1151
1141
        """
1152
 
        if tree_locked and sys.platform == 'win32':
1153
 
            # We expect this to fail because of locking errors. (A write-locked
1154
 
            # file cannot be read-locked in the same process).
 
1142
        def friendly_location(url):
 
1143
            path = urlutils.unescape_for_display(url, 'ascii')
 
1144
            try:
 
1145
                return osutils.relpath(osutils.getcwd(), path)
 
1146
            except errors.PathNotChild:
 
1147
                return path
 
1148
 
 
1149
        if tree_locked:
 
1150
            # We expect this to fail because of locking errors.
 
1151
            # (A write-locked file cannot be read-locked
 
1152
            # in the different process -- either on win32 or on linux).
1155
1153
            # This should be removed when the locking errors are fixed.
1156
 
            args = command_string.split(' ')
1157
 
            self.run_bzr_error([], 'info', *args)
1158
 
            return
1159
 
        out, err = self.runbzr('info %s' % command_string)
 
1154
            self.expectFailure('OS locks are exclusive '
 
1155
                'for different processes (Bug #174055)',
 
1156
                self.run_bzr_subprocess,
 
1157
                'info ' + command_string)
 
1158
        out, err = self.run_bzr('info %s' % command_string)
1160
1159
        description = {
1161
1160
            (True, True): 'Lightweight checkout',
1162
1161
            (True, False): 'Repository checkout',
1163
1162
            (False, True): 'Lightweight checkout',
1164
1163
            (False, False): 'Checkout',
1165
1164
            }[(shared_repo is not None, light_checkout)]
1166
 
        format = {True: 'dirstate or dirstate-tags',
 
1165
        format = {True: 'dirstate or dirstate-tags or pack-0.92'
 
1166
                        ' or rich-root or rich-root-pack',
1167
1167
                  False: 'dirstate'}[light_checkout]
 
1168
        if repo_locked:
 
1169
            repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1168
1170
        if repo_locked or branch_locked or tree_locked:
1169
1171
            def locked_message(a_bool):
1170
1172
                if a_bool:
1186
1188
        extra_space = ''
1187
1189
        if light_checkout:
1188
1190
            tree_data = ("  light checkout root: %s\n" %
1189
 
                lco_tree.bzrdir.root_transport.base)
 
1191
                friendly_location(lco_tree.bzrdir.root_transport.base))
1190
1192
            extra_space = ' '
1191
1193
        if lco_tree.branch.get_bound_location() is not None:
1192
1194
            tree_data += ("%s       checkout root: %s\n" % (extra_space,
1193
 
                lco_tree.branch.bzrdir.root_transport.base))
 
1195
                friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1194
1196
        if shared_repo is not None:
1195
1197
            branch_data = (
1196
1198
                "   checkout of branch: %s\n"
1197
1199
                "    shared repository: %s\n" %
1198
 
                (repo_branch.bzrdir.root_transport.base,
1199
 
                 shared_repo.bzrdir.root_transport.base))
 
1200
                (friendly_location(repo_branch.bzrdir.root_transport.base),
 
1201
                 friendly_location(shared_repo.bzrdir.root_transport.base)))
1200
1202
        elif repo_branch is not None:
1201
1203
            branch_data = (
1202
1204
                "%s  checkout of branch: %s\n" %
1203
1205
                (extra_space,
1204
 
                 repo_branch.bzrdir.root_transport.base))
 
1206
                 friendly_location(repo_branch.bzrdir.root_transport.base)))
1205
1207
        else:
1206
1208
            branch_data = ("   checkout of branch: %s\n" %
1207
1209
                lco_tree.branch.bzrdir.root_transport.base)
1375
1377
        # W B R
1376
1378
 
1377
1379
        # U U U
1378
 
        out, err = self.runbzr('info -v branch')
 
1380
        out, err = self.run_bzr('info -v branch')
1379
1381
        self.assertEqualDiff(
1380
1382
"""Standalone tree (format: weave)
1381
1383
Location:
1404
1406
Repository:
1405
1407
         0 revisions
1406
1408
         0 KiB
1407
 
""" % (tree.bzrdir.root_transport.base,
1408
 
       tree.branch.repository._format.get_format_description(),
 
1409
""" % ('branch', tree.branch.repository._format.get_format_description(),
1409
1410
       ), out)
1410
1411
        self.assertEqual('', err)
1411
1412
        # L L L
1412
1413
        tree.lock_write()
1413
 
        out, err = self.runbzr('info -v branch')
 
1414
        out, err = self.run_bzr('info -v branch')
1414
1415
        self.assertEqualDiff(
1415
1416
"""Standalone tree (format: weave)
1416
1417
Location:
1439
1440
Repository:
1440
1441
         0 revisions
1441
1442
         0 KiB
1442
 
""" % (tree.bzrdir.root_transport.base,
1443
 
       tree.branch.repository._format.get_format_description(),
 
1443
""" % ('branch', tree.branch.repository._format.get_format_description(),
1444
1444
       ), out)
1445
1445
        self.assertEqual('', err)
1446
1446
        tree.unlock()