/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2007-07-11 23:45:20 UTC
  • mfrom: (2601 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070711234520-do3h7zw8skbathpz
[merge] bzr.dev 2601

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
    osutils,
25
27
    repository,
 
28
    urlutils,
26
29
    )
27
30
from bzrlib.osutils import format_date
28
31
from bzrlib.tests import TestSkipped
36
39
            location = "C:/i/do/not/exist/"
37
40
        else:
38
41
            location = "/i/do/not/exist/"
39
 
        out, err = self.runbzr('info '+location, retcode=3)
 
42
        out, err = self.run_bzr('info '+location, retcode=3)
40
43
        self.assertEqual(out, '')
41
44
        self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
42
45
 
48
51
        self.build_tree(['standalone/a'])
49
52
        tree1.add('a')
50
53
        branch1 = tree1.branch
51
 
        out, err = self.runbzr('info standalone')
52
 
        self.assertEqualDiff(
53
 
"""Location:
54
 
  branch root: %s
 
54
 
 
55
        out, err = self.run_bzr('info standalone')
 
56
        self.assertEqualDiff(
 
57
"""Standalone tree (format: weave)
 
58
Location:
 
59
  branch root: standalone
 
60
""", out)
 
61
        self.assertEqual('', err)
 
62
 
 
63
        out, err = self.run_bzr('info standalone -v')
 
64
        self.assertEqualDiff(
 
65
"""Standalone tree (format: weave)
 
66
Location:
 
67
  branch root: standalone
55
68
 
56
69
Format:
57
70
       control: All-in-one format 6
71
84
 
72
85
Branch history:
73
86
         0 revisions
 
87
         0 committers
74
88
 
75
89
Repository:
76
90
         0 revisions
77
91
         0 KiB
78
 
""" % branch1.bzrdir.root_transport.base, out)
 
92
""", out)
79
93
        self.assertEqual('', err)
80
94
        tree1.commit('commit one')
81
95
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
84
98
        # Branch standalone with push location
85
99
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
86
100
        branch2.set_push_location(branch1.bzrdir.root_transport.base)
87
 
        out, err = self.runbzr('info branch --verbose')
88
 
        self.assertEqualDiff(
89
 
"""Location:
90
 
  branch root: %s
91
 
 
92
 
Related branches:
93
 
      parent branch: %s
94
 
  publish to branch: %s
 
101
 
 
102
        out, err = self.run_bzr('info branch')
 
103
        self.assertEqualDiff(
 
104
"""Standalone tree (format: weave)
 
105
Location:
 
106
  branch root: branch
 
107
 
 
108
Related branches:
 
109
    push branch: standalone
 
110
  parent branch: standalone
 
111
""", out)
 
112
        self.assertEqual('', err)
 
113
 
 
114
        out, err = self.run_bzr('info branch --verbose')
 
115
        self.assertEqualDiff(
 
116
"""Standalone tree (format: weave)
 
117
Location:
 
118
  branch root: branch
 
119
 
 
120
Related branches:
 
121
    push branch: standalone
 
122
  parent branch: standalone
95
123
 
96
124
Format:
97
125
       control: All-in-one format 6
119
147
Repository:
120
148
         1 revision
121
149
         %d KiB
122
 
""" % (branch2.bzrdir.root_transport.base,
123
 
       branch1.bzrdir.root_transport.base,
124
 
       branch1.bzrdir.root_transport.base,
125
 
       datestring_first, datestring_first,
 
150
""" % (datestring_first, datestring_first,
126
151
       # poking at _revision_store isn't all that clean, but neither is
127
152
       # having the ui test dependent on the exact overhead of a given store.
128
153
       branch2.repository._revision_store.total_size(
138
163
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
139
164
        branch3.bind(branch1)
140
165
        bound_tree = branch3.bzrdir.open_workingtree()
141
 
        out, err = self.runbzr('info bound')
 
166
        out, err = self.run_bzr('info -v bound')
142
167
        self.assertEqualDiff(
143
 
"""Location:
144
 
       checkout root: %s
145
 
  checkout of branch: %s
 
168
"""Checkout (format: knit)
 
169
Location:
 
170
       checkout root: bound
 
171
  checkout of branch: standalone
146
172
 
147
173
Related branches:
148
 
  parent branch: %s
 
174
  parent branch: standalone
149
175
 
150
176
Format:
151
177
       control: Meta directory format 1
165
191
 
166
192
Branch history:
167
193
         1 revision
 
194
         1 committer
168
195
         0 days old
169
196
   first revision: %s
170
197
  latest revision: %s
172
199
Repository:
173
200
         1 revision
174
201
         %d KiB
175
 
""" % (branch3.bzrdir.root_transport.base,
176
 
       branch1.bzrdir.root_transport.base,
177
 
       branch1.bzrdir.root_transport.base,
178
 
       bound_tree._format.get_format_description(),      
 
202
""" % (bound_tree._format.get_format_description(),
179
203
       branch3._format.get_format_description(),
180
204
       branch3.repository._format.get_format_description(),
181
205
       datestring_first, datestring_first,
191
215
            format=knit1_format)
192
216
        branch4.bind(branch1)
193
217
        branch4.bzrdir.open_workingtree().update()
194
 
        out, err = self.runbzr('info checkout --verbose')
 
218
        out, err = self.run_bzr('info checkout --verbose')
195
219
        self.assertEqualDiff(
196
 
"""Location:
197
 
       checkout root: %s
198
 
  checkout of branch: %s
 
220
"""Checkout (format: knit)
 
221
Location:
 
222
       checkout root: checkout
 
223
  checkout of branch: standalone
199
224
 
200
225
Format:
201
226
       control: Meta directory format 1
223
248
Repository:
224
249
         1 revision
225
250
         %d KiB
226
 
""" % (branch4.bzrdir.root_transport.base,
227
 
       branch1.bzrdir.root_transport.base,
228
 
       branch4.repository._format.get_format_description(),
 
251
""" % (branch4.repository._format.get_format_description(),
229
252
       datestring_first, datestring_first,
230
253
       # poking at _revision_store isn't all that clean, but neither is
231
254
       # having the ui test dependent on the exact overhead of a given store.
237
260
        # Lightweight checkout (same as above, different branch and repository)
238
261
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
239
262
        branch5 = tree5.branch
240
 
        out, err = self.runbzr('info lightcheckout')
 
263
        out, err = self.run_bzr('info -v lightcheckout')
241
264
        self.assertEqualDiff(
242
 
"""Location:
243
 
 light checkout root: %s
244
 
  checkout of branch: %s
 
265
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
266
Location:
 
267
  light checkout root: lightcheckout
 
268
   checkout of branch: standalone
245
269
 
246
270
Format:
247
271
       control: Meta directory format 1
261
285
 
262
286
Branch history:
263
287
         1 revision
 
288
         1 committer
264
289
         0 days old
265
290
   first revision: %s
266
291
  latest revision: %s
268
293
Repository:
269
294
         1 revision
270
295
         0 KiB
271
 
""" % (tree5.bzrdir.root_transport.base,
272
 
       branch1.bzrdir.root_transport.base,
273
 
       datestring_first, datestring_first,
274
 
       ), out)
 
296
""" % (datestring_first, datestring_first,), out)
275
297
        self.assertEqual('', err)
276
298
 
277
299
        # Update initial standalone branch
282
304
        datestring_last = format_date(rev.timestamp, rev.timezone)
283
305
 
284
306
        # Out of date branched standalone branch will not be detected
285
 
        out, err = self.runbzr('info branch')
 
307
        out, err = self.run_bzr('info -v branch')
286
308
        self.assertEqualDiff(
287
 
"""Location:
288
 
  branch root: %s
 
309
"""Standalone tree (format: weave)
 
310
Location:
 
311
  branch root: branch
289
312
 
290
313
Related branches:
291
 
      parent branch: %s
292
 
  publish to branch: %s
 
314
    push branch: standalone
 
315
  parent branch: standalone
293
316
 
294
317
Format:
295
318
       control: All-in-one format 6
309
332
 
310
333
Branch history:
311
334
         1 revision
 
335
         1 committer
312
336
         0 days old
313
337
   first revision: %s
314
338
  latest revision: %s
316
340
Repository:
317
341
         1 revision
318
342
         0 KiB
319
 
""" % (branch2.bzrdir.root_transport.base,
320
 
       branch1.bzrdir.root_transport.base,
321
 
       branch1.bzrdir.root_transport.base,
322
 
       datestring_first, datestring_first,
 
343
""" % (datestring_first, datestring_first,
323
344
       ), out)
324
345
        self.assertEqual('', err)
325
346
 
326
347
        # Out of date bound branch
327
 
        out, err = self.runbzr('info bound')
 
348
        out, err = self.run_bzr('info -v bound')
328
349
        self.assertEqualDiff(
329
 
"""Location:
330
 
       checkout root: %s
331
 
  checkout of branch: %s
 
350
"""Checkout (format: knit)
 
351
Location:
 
352
       checkout root: bound
 
353
  checkout of branch: standalone
332
354
 
333
355
Related branches:
334
 
  parent branch: %s
 
356
  parent branch: standalone
335
357
 
336
358
Format:
337
359
       control: Meta directory format 1
353
375
 
354
376
Branch history:
355
377
         1 revision
 
378
         1 committer
356
379
         0 days old
357
380
   first revision: %s
358
381
  latest revision: %s
360
383
Repository:
361
384
         1 revision
362
385
         %d KiB
363
 
""" % (branch3.bzrdir.root_transport.base,
364
 
       branch1.bzrdir.root_transport.base,
365
 
       branch1.bzrdir.root_transport.base,
366
 
       branch3.repository._format.get_format_description(),
 
386
""" % (branch3.repository._format.get_format_description(),
367
387
       datestring_first, datestring_first,
368
388
       # poking at _revision_store isn't all that clean, but neither is
369
389
       # having the ui test dependent on the exact overhead of a given store.
373
393
        self.assertEqual('', err)
374
394
 
375
395
        # Out of date checkout
376
 
        out, err = self.runbzr('info checkout')
 
396
        out, err = self.run_bzr('info -v checkout')
377
397
        self.assertEqualDiff(
378
 
"""Location:
379
 
       checkout root: %s
380
 
  checkout of branch: %s
 
398
"""Checkout (format: knit)
 
399
Location:
 
400
       checkout root: checkout
 
401
  checkout of branch: standalone
381
402
 
382
403
Format:
383
404
       control: Meta directory format 1
399
420
 
400
421
Branch history:
401
422
         1 revision
 
423
         1 committer
402
424
         0 days old
403
425
   first revision: %s
404
426
  latest revision: %s
406
428
Repository:
407
429
         1 revision
408
430
         %d KiB
409
 
""" % (branch4.bzrdir.root_transport.base,
410
 
       branch1.bzrdir.root_transport.base,
411
 
       branch4.repository._format.get_format_description(),
 
431
""" % (branch4.repository._format.get_format_description(),
412
432
       datestring_first, datestring_first,
413
433
       # poking at _revision_store isn't all that clean, but neither is
414
434
       # having the ui test dependent on the exact overhead of a given store.
418
438
        self.assertEqual('', err)
419
439
 
420
440
        # Out of date lightweight checkout
421
 
        out, err = self.runbzr('info lightcheckout --verbose')
 
441
        out, err = self.run_bzr('info lightcheckout --verbose')
422
442
        self.assertEqualDiff(
423
 
"""Location:
424
 
 light checkout root: %s
425
 
  checkout of branch: %s
 
443
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
444
Location:
 
445
  light checkout root: lightcheckout
 
446
   checkout of branch: standalone
426
447
 
427
448
Format:
428
449
       control: Meta directory format 1
452
473
Repository:
453
474
         2 revisions
454
475
         0 KiB
455
 
""" % (tree5.bzrdir.root_transport.base,
456
 
       branch1.bzrdir.root_transport.base,
457
 
       datestring_first, datestring_last,
458
 
       ), out)
 
476
""" % (datestring_first, datestring_last,), out)
459
477
        self.assertEqual('', err)
460
478
 
461
479
    def test_info_standalone_no_tree(self):
463
481
        format = bzrdir.format_registry.make_bzrdir('default')
464
482
        branch = self.make_branch('branch')
465
483
        repo = branch.repository
466
 
        out, err = self.runbzr('info branch')
 
484
        out, err = self.run_bzr('info branch -v')
467
485
        self.assertEqualDiff(
468
 
"""Location:
469
 
  branch root: %s
 
486
"""Standalone branch (format: dirstate or knit)
 
487
Location:
 
488
  branch root: branch
470
489
 
471
490
Format:
472
491
       control: Meta directory format 1
475
494
 
476
495
Branch history:
477
496
         0 revisions
 
497
         0 committers
478
498
 
479
499
Repository:
480
500
         0 revisions
481
501
         0 KiB
482
 
""" % (branch.bzrdir.root_transport.base,
483
 
       format.get_branch_format().get_format_description(),
 
502
""" % (format.get_branch_format().get_format_description(),
484
503
       format.repository_format.get_format_description(),
485
504
       ), out)
486
505
        self.assertEqual('', err)
492
511
        # Create shared repository
493
512
        repo = self.make_repository('repo', shared=True, format=format)
494
513
        repo.set_make_working_trees(False)
495
 
        out, err = self.runbzr('info repo')
 
514
        out, err = self.run_bzr('info -v repo')
496
515
        self.assertEqualDiff(
497
 
"""Location:
 
516
"""Shared repository (format: dirstate or dirstate-tags or knit)
 
517
Location:
498
518
  shared repository: %s
499
519
 
500
520
Format:
504
524
Repository:
505
525
         0 revisions
506
526
         0 KiB
507
 
""" % (repo.bzrdir.root_transport.base,
508
 
       format.repository_format.get_format_description(),
 
527
""" % ('repo', format.repository_format.get_format_description(),
509
528
       ), out)
510
529
        self.assertEqual('', err)
511
530
 
513
532
        repo.bzrdir.root_transport.mkdir('branch')
514
533
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
515
534
            format=format)
516
 
        out, err = self.runbzr('info repo/branch')
 
535
        out, err = self.run_bzr('info -v repo/branch')
517
536
        self.assertEqualDiff(
518
 
"""Location:
519
 
  shared repository: %s
520
 
  repository branch: branch
 
537
"""Repository branch (format: dirstate or knit)
 
538
Location:
 
539
  shared repository: repo
 
540
  repository branch: repo/branch
521
541
 
522
542
Format:
523
543
       control: Meta directory format 1
526
546
 
527
547
Branch history:
528
548
         0 revisions
 
549
         0 committers
529
550
 
530
551
Repository:
531
552
         0 revisions
532
553
         0 KiB
533
 
""" % (repo.bzrdir.root_transport.base,
534
 
       format.get_branch_format().get_format_description(),
 
554
""" % (format.get_branch_format().get_format_description(),
535
555
       format.repository_format.get_format_description(),
536
556
       ), out)
537
557
        self.assertEqual('', err)
542
562
        tree2 = branch1.create_checkout('tree/lightcheckout', 
543
563
            lightweight=True)
544
564
        branch2 = tree2.branch
545
 
        self.assertCheckoutStatusOutput('tree/lightcheckout', tree2, 
546
 
                   shared_repo=repo)
 
565
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
 
566
                   shared_repo=repo, repo_branch=branch1, verbose=True)
547
567
 
548
568
        # Create normal checkout
549
569
        tree3 = branch1.create_checkout('tree/checkout')
556
576
        tree2.commit('commit one')
557
577
        rev = repo.get_revision(branch2.revision_history()[0])
558
578
        datestring_first = format_date(rev.timestamp, rev.timezone)
559
 
        out, err = self.runbzr('info tree/lightcheckout --verbose')
 
579
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
560
580
        self.assertEqualDiff(
561
 
"""Location:
562
 
 light checkout root: %s
563
 
   shared repository: %s
564
 
   repository branch: branch
 
581
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
582
Location:
 
583
  light checkout root: tree/lightcheckout
 
584
   checkout of branch: repo/branch
 
585
    shared repository: repo
565
586
 
566
587
Format:
567
588
       control: Meta directory format 1
589
610
Repository:
590
611
         1 revision
591
612
         %d KiB
592
 
""" % (tree2.bzrdir.root_transport.base,
593
 
       repo.bzrdir.root_transport.base,
594
 
       format.get_branch_format().get_format_description(),
 
613
""" % (format.get_branch_format().get_format_description(),
595
614
       format.repository_format.get_format_description(),
596
615
       datestring_first, datestring_first,
597
616
       # poking at _revision_store isn't all that clean, but neither is
601
620
        self.assertEqual('', err)
602
621
 
603
622
        # Out of date checkout
604
 
        out, err = self.runbzr('info tree/checkout')
 
623
        out, err = self.run_bzr('info -v tree/checkout')
605
624
        self.assertEqualDiff(
606
 
"""Location:
607
 
       checkout root: %s
608
 
  checkout of branch: %s
 
625
"""Checkout (format: dirstate)
 
626
Location:
 
627
       checkout root: tree/checkout
 
628
  checkout of branch: repo/branch
609
629
 
610
630
Format:
611
631
       control: Meta directory format 1
627
647
 
628
648
Branch history:
629
649
         0 revisions
 
650
         0 committers
630
651
 
631
652
Repository:
632
653
         0 revisions
633
654
         0 KiB
634
 
""" % (tree3.bzrdir.root_transport.base,
635
 
       branch1.bzrdir.root_transport.base,
636
 
       format.get_branch_format().get_format_description(),
 
655
""" % (format.get_branch_format().get_format_description(),
637
656
       format.repository_format.get_format_description(),
638
657
       ), out)
639
658
        self.assertEqual('', err)
642
661
        tree3.update()
643
662
        self.build_tree(['tree/checkout/b'])
644
663
        tree3.add('b')
645
 
        out, err = self.runbzr('info tree/checkout --verbose')
 
664
        out, err = self.run_bzr('info tree/checkout --verbose')
646
665
        self.assertEqualDiff(
647
 
"""Location:
648
 
       checkout root: %s
649
 
  checkout of branch: %s
 
666
"""Checkout (format: dirstate)
 
667
Location:
 
668
       checkout root: tree/checkout
 
669
  checkout of branch: repo/branch
650
670
 
651
671
Format:
652
672
       control: Meta directory format 1
674
694
Repository:
675
695
         1 revision
676
696
         %d KiB
677
 
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
678
 
       format.get_branch_format().get_format_description(),
 
697
""" % (format.get_branch_format().get_format_description(),
679
698
       format.repository_format.get_format_description(),
680
699
       datestring_first, datestring_first,
681
700
       # poking at _revision_store isn't all that clean, but neither is
688
707
        # Out of date lightweight checkout
689
708
        rev = repo.get_revision(branch1.revision_history()[-1])
690
709
        datestring_last = format_date(rev.timestamp, rev.timezone)
691
 
        out, err = self.runbzr('info tree/lightcheckout --verbose')
 
710
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
692
711
        self.assertEqualDiff(
693
 
"""Location:
694
 
 light checkout root: %s
695
 
   shared repository: %s
696
 
   repository branch: branch
 
712
"""Lightweight checkout (format: dirstate or dirstate-tags)
 
713
Location:
 
714
  light checkout root: tree/lightcheckout
 
715
   checkout of branch: repo/branch
 
716
    shared repository: repo
697
717
 
698
718
Format:
699
719
       control: Meta directory format 1
723
743
Repository:
724
744
         2 revisions
725
745
         %d KiB
726
 
""" % (tree2.bzrdir.root_transport.base,
727
 
       repo.bzrdir.root_transport.base,
728
 
       format.get_branch_format().get_format_description(),
 
746
""" % (format.get_branch_format().get_format_description(),
729
747
       format.repository_format.get_format_description(),
730
748
       datestring_first, datestring_last,
731
749
       # poking at _revision_store isn't all that clean, but neither is
735
753
        self.assertEqual('', err)
736
754
 
737
755
        # Show info about shared branch
738
 
        out, err = self.runbzr('info repo/branch --verbose')
 
756
        out, err = self.run_bzr('info repo/branch --verbose')
739
757
        self.assertEqualDiff(
740
 
"""Location:
741
 
  shared repository: %s
742
 
  repository branch: branch
 
758
"""Repository branch (format: dirstate or knit)
 
759
Location:
 
760
  shared repository: repo
 
761
  repository branch: repo/branch
743
762
 
744
763
Format:
745
764
       control: Meta directory format 1
756
775
Repository:
757
776
         2 revisions
758
777
         %d KiB
759
 
""" % (repo.bzrdir.root_transport.base,
760
 
       format.get_branch_format().get_format_description(),
 
778
""" % (format.get_branch_format().get_format_description(),
761
779
       format.repository_format.get_format_description(),
762
780
       datestring_first, datestring_last,
763
781
       # poking at _revision_store isn't all that clean, but neither is
767
785
        self.assertEqual('', err)
768
786
 
769
787
        # Show info about repository with revisions
770
 
        out, err = self.runbzr('info repo')
 
788
        out, err = self.run_bzr('info -v repo')
771
789
        self.assertEqualDiff(
772
 
"""Location:
773
 
  shared repository: %s
 
790
"""Shared repository (format: dirstate or dirstate-tags or knit)
 
791
Location:
 
792
  shared repository: repo
774
793
 
775
794
Format:
776
795
       control: Meta directory format 1
779
798
Repository:
780
799
         2 revisions
781
800
         %d KiB
782
 
""" % (repo.bzrdir.root_transport.base,
783
 
       format.repository_format.get_format_description(),
 
801
""" % (format.repository_format.get_format_description(),
784
802
       # poking at _revision_store isn't all that clean, but neither is
785
803
       # having the ui test dependent on the exact overhead of a given store.
786
804
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
794
812
        # Create shared repository with working trees
795
813
        repo = self.make_repository('repo', shared=True, format=format)
796
814
        repo.set_make_working_trees(True)
797
 
        out, err = self.runbzr('info repo')
 
815
        out, err = self.run_bzr('info -v repo')
798
816
        self.assertEqualDiff(
799
 
"""Location:
800
 
  shared repository: %s
 
817
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
818
Location:
 
819
  shared repository: repo
801
820
 
802
821
Format:
803
822
       control: Meta directory format 1
808
827
Repository:
809
828
         0 revisions
810
829
         0 KiB
811
 
""" % (repo.bzrdir.root_transport.base,
812
 
       format.repository_format.get_format_description(),
 
830
""" % (format.repository_format.get_format_description(),
813
831
       ), out)
814
832
        self.assertEqual('', err)
815
833
 
820
838
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
821
839
 
822
840
        # Empty first branch
823
 
        out, err = self.runbzr('info repo/branch1 --verbose')
 
841
        out, err = self.run_bzr('info repo/branch1 --verbose')
824
842
        self.assertEqualDiff(
825
 
"""Location:
826
 
    shared repository: %s
827
 
  repository checkout: branch1
 
843
"""Repository tree (format: knit)
 
844
Location:
 
845
  shared repository: repo
 
846
  repository branch: repo/branch1
828
847
 
829
848
Format:
830
849
       control: Meta directory format 1
849
868
Repository:
850
869
         0 revisions
851
870
         0 KiB
852
 
""" % (repo.bzrdir.root_transport.base,
853
 
       format.get_branch_format().get_format_description(),
 
871
""" % (format.get_branch_format().get_format_description(),
854
872
       format.repository_format.get_format_description(),
855
873
       ), out)
856
874
        self.assertEqual('', err)
862
880
        tree1.commit('commit one')
863
881
        rev = repo.get_revision(branch1.revision_history()[0])
864
882
        datestring_first = format_date(rev.timestamp, rev.timezone)
865
 
        out, err = self.runbzr('info repo/branch1')
 
883
        out, err = self.run_bzr('info -v repo/branch1')
866
884
        self.assertEqualDiff(
867
 
"""Location:
868
 
    shared repository: %s
869
 
  repository checkout: branch1
 
885
"""Repository tree (format: knit)
 
886
Location:
 
887
  shared repository: repo
 
888
  repository branch: repo/branch1
870
889
 
871
890
Format:
872
891
       control: Meta directory format 1
886
905
 
887
906
Branch history:
888
907
         1 revision
 
908
         1 committer
889
909
         0 days old
890
910
   first revision: %s
891
911
  latest revision: %s
893
913
Repository:
894
914
         1 revision
895
915
         %d KiB
896
 
""" % (repo.bzrdir.root_transport.base,
897
 
       format.get_branch_format().get_format_description(),
 
916
""" % (format.get_branch_format().get_format_description(),
898
917
       format.repository_format.get_format_description(),
899
918
       datestring_first, datestring_first,
900
919
       # poking at _revision_store isn't all that clean, but neither is
904
923
        self.assertEqual('', err)
905
924
 
906
925
        # Out of date second branch
907
 
        out, err = self.runbzr('info repo/branch2 --verbose')
 
926
        out, err = self.run_bzr('info repo/branch2 --verbose')
908
927
        self.assertEqualDiff(
909
 
"""Location:
910
 
    shared repository: %s
911
 
  repository checkout: branch2
 
928
"""Repository tree (format: knit)
 
929
Location:
 
930
  shared repository: repo
 
931
  repository branch: repo/branch2
912
932
 
913
933
Related branches:
914
 
  parent branch: %s
 
934
  parent branch: repo/branch1
915
935
 
916
936
Format:
917
937
       control: Meta directory format 1
936
956
Repository:
937
957
         1 revision
938
958
         %d KiB
939
 
""" % (repo.bzrdir.root_transport.base,
940
 
       branch1.bzrdir.root_transport.base,
941
 
       format.get_branch_format().get_format_description(),
 
959
""" % (format.get_branch_format().get_format_description(),
942
960
       format.repository_format.get_format_description(),
943
961
       # poking at _revision_store isn't all that clean, but neither is
944
962
       # having the ui test dependent on the exact overhead of a given store.
949
967
        # Update second branch
950
968
        tree2 = branch2.bzrdir.open_workingtree()
951
969
        tree2.pull(branch1)
952
 
        out, err = self.runbzr('info repo/branch2')
 
970
        out, err = self.run_bzr('info -v repo/branch2')
953
971
        self.assertEqualDiff(
954
 
"""Location:
955
 
    shared repository: %s
956
 
  repository checkout: branch2
 
972
"""Repository tree (format: knit)
 
973
Location:
 
974
  shared repository: repo
 
975
  repository branch: repo/branch2
957
976
 
958
977
Related branches:
959
 
  parent branch: %s
 
978
  parent branch: repo/branch1
960
979
 
961
980
Format:
962
981
       control: Meta directory format 1
976
995
 
977
996
Branch history:
978
997
         1 revision
 
998
         1 committer
979
999
         0 days old
980
1000
   first revision: %s
981
1001
  latest revision: %s
983
1003
Repository:
984
1004
         1 revision
985
1005
         %d KiB
986
 
""" % (repo.bzrdir.root_transport.base,
987
 
       branch1.bzrdir.root_transport.base,
988
 
       format.get_branch_format().get_format_description(),
 
1006
""" % (format.get_branch_format().get_format_description(),
989
1007
       format.repository_format.get_format_description(),
990
1008
       datestring_first, datestring_first,
991
1009
       # poking at _revision_store isn't all that clean, but neither is
995
1013
        self.assertEqual('', err)
996
1014
 
997
1015
        # Show info about repository with revisions
998
 
        out, err = self.runbzr('info repo')
 
1016
        out, err = self.run_bzr('info -v repo')
999
1017
        self.assertEqualDiff(
1000
 
"""Location:
1001
 
  shared repository: %s
 
1018
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
1019
Location:
 
1020
  shared repository: repo
1002
1021
 
1003
1022
Format:
1004
1023
       control: Meta directory format 1
1009
1028
Repository:
1010
1029
         1 revision
1011
1030
         %d KiB
1012
 
""" % (repo.bzrdir.root_transport.base,
1013
 
       format.repository_format.get_format_description(),
 
1031
""" % (format.repository_format.get_format_description(),
1014
1032
       # poking at _revision_store isn't all that clean, but neither is
1015
1033
       # having the ui test dependent on the exact overhead of a given store.
1016
1034
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1025
1043
        # Create shared repository with working trees
1026
1044
        repo = self.make_repository('repo', shared=True, format=format)
1027
1045
        repo.set_make_working_trees(True)
1028
 
        out, err = self.runbzr('info repo')
 
1046
        out, err = self.run_bzr('info -v repo')
1029
1047
        self.assertEqualDiff(
1030
 
"""Location:
1031
 
  shared repository: %s
 
1048
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
1049
Location:
 
1050
  shared repository: repo
1032
1051
 
1033
1052
Format:
1034
1053
       control: Meta directory format 1
1039
1058
Repository:
1040
1059
         0 revisions
1041
1060
         0 KiB
1042
 
""" % (repo.bzrdir.root_transport.base,
1043
 
       format.repository_format.get_format_description(),
 
1061
""" % (format.repository_format.get_format_description(),
1044
1062
       ), out)
1045
1063
        self.assertEqual('', err)
1046
1064
 
1048
1066
        control = repo.bzrdir
1049
1067
        branch = control.create_branch()
1050
1068
        control.create_workingtree()
1051
 
        out, err = self.runbzr('info repo')
 
1069
        out, err = self.run_bzr('info -v repo')
1052
1070
        self.assertEqualDiff(
1053
 
"""Location:
1054
 
    shared repository: %s
1055
 
  repository checkout: .
 
1071
"""Repository tree (format: knit)
 
1072
Location:
 
1073
  shared repository: repo
 
1074
  repository branch: repo
1056
1075
 
1057
1076
Format:
1058
1077
       control: Meta directory format 1
1072
1091
 
1073
1092
Branch history:
1074
1093
         0 revisions
 
1094
         0 committers
1075
1095
 
1076
1096
Repository:
1077
1097
         0 revisions
1078
1098
         0 KiB
1079
 
""" % (repo.bzrdir.root_transport.base,
1080
 
       format.get_branch_format().get_format_description(),
 
1099
""" % (format.get_branch_format().get_format_description(),
1081
1100
       format.repository_format.get_format_description(),
1082
1101
       ), out)
1083
1102
        self.assertEqual('', err)
1088
1107
        tree_locked=False,
1089
1108
        branch_locked=False, repo_locked=False,
1090
1109
        verbose=False,
1091
 
        light_checkout=True):
1092
 
        """Check the output of info in a light checkout tree.
 
1110
        light_checkout=True,
 
1111
        checkout_root=None):
 
1112
        """Check the output of info in a checkout.
1093
1113
 
1094
1114
        This is not quite a mirror of the info code: rather than using the
1095
1115
        tree being examined to predict output, it uses a bunch of flags which
1108
1128
        :param repo_locked: If true, expect the repository to be locked.
1109
1129
        :param verbose: If true, expect verbose output
1110
1130
        """
 
1131
        def friendly_location(url):
 
1132
            path = urlutils.unescape_for_display(url, 'ascii')
 
1133
            try:
 
1134
                return osutils.relpath(os.getcwd(), path)
 
1135
            except errors.PathNotChild:
 
1136
                return path
 
1137
 
1111
1138
        if tree_locked and sys.platform == 'win32':
1112
1139
            # We expect this to fail because of locking errors. (A write-locked
1113
1140
            # file cannot be read-locked in the same process).
1115
1142
            args = command_string.split(' ')
1116
1143
            self.run_bzr_error([], 'info', *args)
1117
1144
            return
1118
 
        out, err = self.runbzr('info %s' % command_string)
 
1145
        out, err = self.run_bzr('info %s' % command_string)
 
1146
        description = {
 
1147
            (True, True): 'Lightweight checkout',
 
1148
            (True, False): 'Repository checkout',
 
1149
            (False, True): 'Lightweight checkout',
 
1150
            (False, False): 'Checkout',
 
1151
            }[(shared_repo is not None, light_checkout)]
 
1152
        format = {True: 'dirstate or dirstate-tags',
 
1153
                  False: 'dirstate'}[light_checkout]
1119
1154
        if repo_locked or branch_locked or tree_locked:
1120
1155
            def locked_message(a_bool):
1121
1156
                if a_bool:
1133
1168
                    locked_message(repo_locked)))
1134
1169
        else:
1135
1170
            expected_lock_output = ''
 
1171
        tree_data = ''
 
1172
        extra_space = ''
1136
1173
        if light_checkout:
1137
 
            tree_data = (" light checkout root: %s" %
1138
 
                lco_tree.bzrdir.root_transport.base)
1139
 
        else:
1140
 
            tree_data = ("       checkout root: %s" %
1141
 
                lco_tree.bzrdir.root_transport.base)
 
1174
            tree_data = ("  light checkout root: %s\n" %
 
1175
                friendly_location(lco_tree.bzrdir.root_transport.base))
 
1176
            extra_space = ' '
 
1177
        if lco_tree.branch.get_bound_location() is not None:
 
1178
            tree_data += ("%s       checkout root: %s\n" % (extra_space,
 
1179
                friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
1142
1180
        if shared_repo is not None:
1143
1181
            branch_data = (
1144
 
                "   shared repository: %s\n"
1145
 
                "   repository branch: branch\n" %
1146
 
                shared_repo.bzrdir.root_transport.base)
 
1182
                "   checkout of branch: %s\n"
 
1183
                "    shared repository: %s\n" %
 
1184
                (friendly_location(repo_branch.bzrdir.root_transport.base),
 
1185
                 friendly_location(shared_repo.bzrdir.root_transport.base)))
1147
1186
        elif repo_branch is not None:
1148
1187
            branch_data = (
1149
 
                "  checkout of branch: %s\n" % 
1150
 
                repo_branch.bzrdir.root_transport.base)
 
1188
                "%s  checkout of branch: %s\n" %
 
1189
                (extra_space,
 
1190
                 friendly_location(repo_branch.bzrdir.root_transport.base)))
1151
1191
        else:
1152
 
            branch_data = ("  checkout of branch: %s\n" % 
 
1192
            branch_data = ("   checkout of branch: %s\n" %
1153
1193
                lco_tree.branch.bzrdir.root_transport.base)
1154
1194
        
1155
1195
        if verbose:
1158
1198
            verbose_info = ''
1159
1199
            
1160
1200
        self.assertEqualDiff(
1161
 
"""Location:
1162
 
%s
1163
 
%s
 
1201
"""%s (format: %s)
 
1202
Location:
 
1203
%s%s
1164
1204
Format:
1165
1205
       control: Meta directory format 1
1166
1206
  working tree: %s
1183
1223
Repository:
1184
1224
         0 revisions
1185
1225
         0 KiB
1186
 
""" %  (tree_data,
 
1226
""" %  (description,
 
1227
        format,
 
1228
        tree_data,
1187
1229
        branch_data,
1188
1230
        lco_tree._format.get_format_description(),
1189
1231
        lco_tree.branch._format.get_format_description(),
1219
1261
        # W B R
1220
1262
 
1221
1263
        # U U U
1222
 
        self.assertCheckoutStatusOutput('tree/lightcheckout', lco_tree)
 
1264
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
 
1265
                                        repo_branch=repo_branch,
 
1266
                                        verbose=True, light_checkout=True)
1223
1267
        # U U L
1224
1268
        lco_tree.branch.repository.lock_write()
1225
1269
        try:
1226
 
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1227
 
            lco_tree,
1228
 
            repo_locked=True)
 
1270
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
 
1271
            lco_tree, repo_branch=repo_branch,
 
1272
            repo_locked=True, verbose=True, light_checkout=True)
1229
1273
        finally:
1230
1274
            lco_tree.branch.repository.unlock()
1231
1275
        # U L L
1232
1276
        lco_tree.branch.lock_write()
1233
1277
        try:
1234
 
            self.assertCheckoutStatusOutput('tree/lightcheckout',
 
1278
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1235
1279
            lco_tree,
1236
1280
            branch_locked=True,
1237
 
            repo_locked=True)
 
1281
            repo_locked=True,
 
1282
            repo_branch=repo_branch,
 
1283
            verbose=True)
1238
1284
        finally:
1239
1285
            lco_tree.branch.unlock()
1240
1286
        # L L L
1241
1287
        lco_tree.lock_write()
1242
1288
        try:
1243
 
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1244
 
            lco_tree,
 
1289
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
 
1290
            lco_tree, repo_branch=repo_branch,
1245
1291
            tree_locked=True,
1246
1292
            branch_locked=True,
1247
 
            repo_locked=True)
 
1293
            repo_locked=True,
 
1294
            verbose=True)
1248
1295
        finally:
1249
1296
            lco_tree.unlock()
1250
1297
        # L L U
1251
1298
        lco_tree.lock_write()
1252
1299
        lco_tree.branch.repository.unlock()
1253
1300
        try:
1254
 
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1255
 
            lco_tree,
 
1301
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
 
1302
            lco_tree, repo_branch=repo_branch,
1256
1303
            tree_locked=True,
1257
 
            branch_locked=True)
 
1304
            branch_locked=True,
 
1305
            verbose=True)
1258
1306
        finally:
1259
1307
            lco_tree.branch.repository.lock_write()
1260
1308
            lco_tree.unlock()
1262
1310
        lco_tree.lock_write()
1263
1311
        lco_tree.branch.unlock()
1264
1312
        try:
1265
 
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1266
 
            lco_tree,
1267
 
            tree_locked=True)
 
1313
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
 
1314
            lco_tree, repo_branch=repo_branch,
 
1315
            tree_locked=True,
 
1316
            verbose=True)
1268
1317
        finally:
1269
1318
            lco_tree.branch.lock_write()
1270
1319
            lco_tree.unlock()
1273
1322
        lco_tree.branch.unlock()
1274
1323
        lco_tree.branch.repository.lock_write()
1275
1324
        try:
1276
 
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1277
 
            lco_tree,
 
1325
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
 
1326
            lco_tree, repo_branch=repo_branch,
1278
1327
            tree_locked=True,
1279
 
            repo_locked=True)
 
1328
            repo_locked=True,
 
1329
            verbose=True)
1280
1330
        finally:
1281
1331
            lco_tree.branch.repository.unlock()
1282
1332
            lco_tree.branch.lock_write()
1285
1335
        lco_tree.branch.lock_write()
1286
1336
        lco_tree.branch.repository.unlock()
1287
1337
        try:
1288
 
            self.assertCheckoutStatusOutput('tree/lightcheckout',
1289
 
            lco_tree,
1290
 
            branch_locked=True)
 
1338
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
 
1339
            lco_tree, repo_branch=repo_branch,
 
1340
            branch_locked=True,
 
1341
            verbose=True)
1291
1342
        finally:
1292
1343
            lco_tree.branch.repository.lock_write()
1293
1344
            lco_tree.branch.unlock()
1310
1361
        # W B R
1311
1362
 
1312
1363
        # U U U
1313
 
        out, err = self.runbzr('info branch')
 
1364
        out, err = self.run_bzr('info -v branch')
1314
1365
        self.assertEqualDiff(
1315
 
"""Location:
 
1366
"""Standalone tree (format: weave)
 
1367
Location:
1316
1368
  branch root: %s
1317
1369
 
1318
1370
Format:
1333
1385
 
1334
1386
Branch history:
1335
1387
         0 revisions
 
1388
         0 committers
1336
1389
 
1337
1390
Repository:
1338
1391
         0 revisions
1339
1392
         0 KiB
1340
 
""" % (tree.bzrdir.root_transport.base,
1341
 
       tree.branch.repository._format.get_format_description(),
 
1393
""" % ('branch', tree.branch.repository._format.get_format_description(),
1342
1394
       ), out)
1343
1395
        self.assertEqual('', err)
1344
1396
        # L L L
1345
1397
        tree.lock_write()
1346
 
        out, err = self.runbzr('info branch')
 
1398
        out, err = self.run_bzr('info -v branch')
1347
1399
        self.assertEqualDiff(
1348
 
"""Location:
 
1400
"""Standalone tree (format: weave)
 
1401
Location:
1349
1402
  branch root: %s
1350
1403
 
1351
1404
Format:
1366
1419
 
1367
1420
Branch history:
1368
1421
         0 revisions
 
1422
         0 committers
1369
1423
 
1370
1424
Repository:
1371
1425
         0 revisions
1372
1426
         0 KiB
1373
 
""" % (tree.bzrdir.root_transport.base,
1374
 
       tree.branch.repository._format.get_format_description(),
 
1427
""" % ('branch', tree.branch.repository._format.get_format_description(),
1375
1428
       ), out)
1376
1429
        self.assertEqual('', err)
1377
1430
        tree.unlock()