~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2013-07-13 19:05:24 UTC
  • mto: This revision was merged to the branch mainline in revision 6580.
  • Revision ID: v.ladeuil+lp@free.fr-20130713190524-3bclzq4hpwkd6hkw
Urgh. pqm still runs python 2.6 so we have to maintain compatibility to land the fix 8-(

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006-2012 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
 
20
import shutil
21
21
import sys
22
22
 
23
 
import bzrlib
24
23
from bzrlib import (
 
24
    branch,
25
25
    bzrdir,
 
26
    controldir,
26
27
    errors,
27
28
    info,
28
29
    osutils,
29
 
    repository,
 
30
    tests,
 
31
    upgrade,
30
32
    urlutils,
31
33
    )
32
 
from bzrlib.osutils import format_date
33
 
from bzrlib.tests import TestSkipped
34
 
from bzrlib.tests.blackbox import ExternalBase
35
 
 
36
 
 
37
 
class TestInfo(ExternalBase):
 
34
from bzrlib.tests.matchers import ContainsNoVfsCalls
 
35
from bzrlib.transport import memory
 
36
 
 
37
 
 
38
class TestInfo(tests.TestCaseWithTransport):
 
39
 
 
40
    def setUp(self):
 
41
        super(TestInfo, self).setUp()
 
42
        self._repo_strings = "2a"
38
43
 
39
44
    def test_info_non_existing(self):
40
 
        if sys.platform == "win32":
41
 
            location = "C:/i/do/not/exist/"
42
 
        else:
43
 
            location = "/i/do/not/exist/"
 
45
        self.vfs_transport_factory = memory.MemoryServer
 
46
        location = self.get_url()
44
47
        out, err = self.run_bzr('info '+location, retcode=3)
45
48
        self.assertEqual(out, '')
46
49
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
47
50
 
 
51
    def test_info_empty_controldir(self):
 
52
        self.make_bzrdir('ctrl')
 
53
        out, err = self.run_bzr('info ctrl')
 
54
        self.assertEquals(out,
 
55
            'Empty control directory (format: 2a or pack-0.92)\n'
 
56
            'Location:\n'
 
57
            '  control directory: ctrl\n')
 
58
        self.assertEquals(err, '')
 
59
 
 
60
    def test_info_empty_controldir_verbose(self):
 
61
        self.make_bzrdir('ctrl')
 
62
        out, err = self.run_bzr('info -v ctrl')
 
63
        self.assertEqualDiff(out,
 
64
            'Empty control directory (format: 2a or pack-0.92)\n'
 
65
            'Location:\n'
 
66
            '  control directory: ctrl\n\n'
 
67
            'Format:\n'
 
68
            '       control: Meta directory format 1\n\n'
 
69
            'Control directory:\n'
 
70
            '         0 branches\n')
 
71
        self.assertEquals(err, '')
 
72
 
 
73
    def test_info_dangling_branch_reference(self):
 
74
        br = self.make_branch('target')
 
75
        br.create_checkout('from', lightweight=True)
 
76
        shutil.rmtree('target')
 
77
        out, err = self.run_bzr('info from')
 
78
        self.assertEquals(out,
 
79
            'Dangling branch reference (format: 2a or pack-0.92)\n'
 
80
            'Location:\n'
 
81
            '   control directory: from\n'
 
82
            '  checkout of branch: target\n')
 
83
        self.assertEquals(err, '')
 
84
 
48
85
    def test_info_standalone(self):
49
86
        transport = self.get_transport()
50
87
 
51
88
        # Create initial standalone branch
52
 
        tree1 = self.make_branch_and_tree('standalone', 'weave')
 
89
        tree1 = self.make_branch_and_tree('standalone', 'knit')
53
90
        self.build_tree(['standalone/a'])
54
91
        tree1.add('a')
55
92
        branch1 = tree1.branch
56
93
 
57
94
        out, err = self.run_bzr('info standalone')
58
95
        self.assertEqualDiff(
59
 
"""Standalone tree (format: weave)
 
96
"""Standalone tree (format: knit)
60
97
Location:
61
98
  branch root: standalone
62
99
""", out)
63
100
        self.assertEqual('', err)
64
101
 
 
102
        # Standalone branch - verbose mode
65
103
        out, err = self.run_bzr('info standalone -v')
66
104
        self.assertEqualDiff(
67
 
"""Standalone tree (format: weave)
68
 
Location:
69
 
  branch root: standalone
70
 
 
71
 
Format:
72
 
       control: All-in-one format 6
73
 
  working tree: Working tree format 2
74
 
        branch: Branch format 4
75
 
    repository: Weave repository format 6
 
105
"""Standalone tree (format: knit)
 
106
Location:
 
107
  branch root: standalone
 
108
 
 
109
Format:
 
110
       control: Meta directory format 1
 
111
  working tree: Working tree format 3
 
112
        branch: Branch format 5
 
113
    repository: Knit repository format 1
 
114
 
 
115
Control directory:
 
116
         1 branches
 
117
 
 
118
In the working tree:
 
119
         0 unchanged
 
120
         0 modified
 
121
         1 added
 
122
         0 removed
 
123
         0 renamed
 
124
         0 unknown
 
125
         0 ignored
 
126
         0 versioned subdirectories
 
127
 
 
128
Branch history:
 
129
         0 revisions
 
130
 
 
131
Repository:
 
132
         0 revisions
 
133
""", out)
 
134
        self.assertEqual('', err)
 
135
 
 
136
        # Standalone branch - really verbose mode
 
137
        out, err = self.run_bzr('info standalone -vv')
 
138
        self.assertEqualDiff(
 
139
"""Standalone tree (format: knit)
 
140
Location:
 
141
  branch root: standalone
 
142
 
 
143
Format:
 
144
       control: Meta directory format 1
 
145
  working tree: Working tree format 3
 
146
        branch: Branch format 5
 
147
    repository: Knit repository format 1
 
148
 
 
149
Control directory:
 
150
         1 branches
76
151
 
77
152
In the working tree:
78
153
         0 unchanged
90
165
 
91
166
Repository:
92
167
         0 revisions
93
 
         0 KiB
94
168
""", out)
95
169
        self.assertEqual('', err)
96
170
        tree1.commit('commit one')
97
 
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
98
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
171
        rev = branch1.repository.get_revision(branch1.last_revision())
 
172
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
99
173
 
100
174
        # Branch standalone with push location
101
175
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
103
177
 
104
178
        out, err = self.run_bzr('info branch')
105
179
        self.assertEqualDiff(
106
 
"""Standalone tree (format: weave)
 
180
"""Standalone tree (format: knit)
107
181
Location:
108
182
  branch root: branch
109
183
 
115
189
 
116
190
        out, err = self.run_bzr('info branch --verbose')
117
191
        self.assertEqualDiff(
118
 
"""Standalone tree (format: weave)
 
192
"""Standalone tree (format: knit)
119
193
Location:
120
194
  branch root: branch
121
195
 
124
198
  parent branch: standalone
125
199
 
126
200
Format:
127
 
       control: All-in-one format 6
128
 
  working tree: Working tree format 2
129
 
        branch: Branch format 4
130
 
    repository: Weave repository format 6
 
201
       control: Meta directory format 1
 
202
  working tree: Working tree format 3
 
203
        branch: Branch format 5
 
204
    repository: Knit repository format 1
 
205
 
 
206
Control directory:
 
207
         1 branches
131
208
 
132
209
In the working tree:
133
210
         1 unchanged
141
218
 
142
219
Branch history:
143
220
         1 revision
144
 
         1 committer
145
221
         0 days old
146
222
   first revision: %s
147
223
  latest revision: %s
148
224
 
149
225
Repository:
150
226
         1 revision
151
 
         %d KiB
152
227
""" % (datestring_first, datestring_first,
153
 
       # poking at _revision_store isn't all that clean, but neither is
154
 
       # having the ui test dependent on the exact overhead of a given store.
155
 
       branch2.repository._revision_store.total_size(
156
 
        branch2.repository.get_transaction())[1] / 1024,
157
228
       ), out)
158
229
        self.assertEqual('', err)
159
230
 
160
231
        # Branch and bind to standalone, needs upgrade to metadir
161
232
        # (creates backup as unknown)
162
233
        branch1.bzrdir.sprout('bound')
163
 
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
164
 
        bzrlib.upgrade.upgrade('bound', knit1_format)
165
 
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
 
234
        knit1_format = controldir.format_registry.make_bzrdir('knit')
 
235
        upgrade.upgrade('bound', knit1_format)
 
236
        branch3 = controldir.ControlDir.open('bound').open_branch()
166
237
        branch3.bind(branch1)
167
238
        bound_tree = branch3.bzrdir.open_workingtree()
168
239
        out, err = self.run_bzr('info -v bound')
181
252
        branch: %s
182
253
    repository: %s
183
254
 
 
255
Control directory:
 
256
         1 branches
 
257
 
184
258
In the working tree:
185
259
         1 unchanged
186
260
         0 modified
187
261
         0 added
188
262
         0 removed
189
263
         0 renamed
190
 
         1 unknown
 
264
         0 unknown
191
265
         0 ignored
192
266
         0 versioned subdirectories
193
267
 
194
268
Branch history:
195
269
         1 revision
196
 
         1 committer
197
270
         0 days old
198
271
   first revision: %s
199
272
  latest revision: %s
200
273
 
201
274
Repository:
202
275
         1 revision
203
 
         %d KiB
204
276
""" % (bound_tree._format.get_format_description(),
205
277
       branch3._format.get_format_description(),
206
278
       branch3.repository._format.get_format_description(),
207
279
       datestring_first, datestring_first,
208
 
       # poking at _revision_store isn't all that clean, but neither is
209
 
       # having the ui test dependent on the exact overhead of a given store.
210
 
       branch3.repository._revision_store.total_size(
211
 
        branch3.repository.get_transaction())[1] / 1024,
212
280
       ), out)
213
281
        self.assertEqual('', err)
214
282
 
215
283
        # Checkout standalone (same as above, but does not have parent set)
216
 
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
 
284
        branch4 = controldir.ControlDir.create_branch_convenience('checkout',
217
285
            format=knit1_format)
218
286
        branch4.bind(branch1)
219
287
        branch4.bzrdir.open_workingtree().update()
230
298
        branch: Branch format 5
231
299
    repository: %s
232
300
 
 
301
Control directory:
 
302
         1 branches
 
303
 
233
304
In the working tree:
234
305
         1 unchanged
235
306
         0 modified
242
313
 
243
314
Branch history:
244
315
         1 revision
245
 
         1 committer
246
316
         0 days old
247
317
   first revision: %s
248
318
  latest revision: %s
249
319
 
250
320
Repository:
251
321
         1 revision
252
 
         %d KiB
253
322
""" % (branch4.repository._format.get_format_description(),
254
323
       datestring_first, datestring_first,
255
 
       # poking at _revision_store isn't all that clean, but neither is
256
 
       # having the ui test dependent on the exact overhead of a given store.
257
 
       branch4.repository._revision_store.total_size(
258
 
        branch4.repository.get_transaction())[1] / 1024,
259
324
       ), out)
260
325
        self.assertEqual('', err)
261
326
 
263
328
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
264
329
        branch5 = tree5.branch
265
330
        out, err = self.run_bzr('info -v lightcheckout')
 
331
        if "metaweave" in controldir.format_registry:
 
332
            format_description = "knit or metaweave"
 
333
        else:
 
334
            format_description = "knit"
266
335
        self.assertEqualDiff(
267
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
268
 
pack-0.92 or rich-root or rich-root-pack)
 
336
"""Lightweight checkout (format: %s)
269
337
Location:
270
338
  light checkout root: lightcheckout
271
339
   checkout of branch: standalone
272
340
 
273
341
Format:
274
342
       control: Meta directory format 1
275
 
  working tree: Working tree format 4
276
 
        branch: Branch format 4
277
 
    repository: Weave repository format 6
 
343
  working tree: Working tree format 3
 
344
        branch: Branch format 5
 
345
    repository: Knit repository format 1
 
346
 
 
347
Control directory:
 
348
         1 branches
278
349
 
279
350
In the working tree:
280
351
         1 unchanged
288
359
 
289
360
Branch history:
290
361
         1 revision
291
 
         1 committer
292
362
         0 days old
293
363
   first revision: %s
294
364
  latest revision: %s
295
365
 
296
366
Repository:
297
367
         1 revision
298
 
         0 KiB
299
 
""" % (datestring_first, datestring_first,), out)
 
368
""" % (format_description, datestring_first, datestring_first,), out)
300
369
        self.assertEqual('', err)
301
370
 
302
371
        # Update initial standalone branch
303
372
        self.build_tree(['standalone/b'])
304
373
        tree1.add('b')
305
374
        tree1.commit('commit two')
306
 
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
307
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
375
        rev = branch1.repository.get_revision(branch1.last_revision())
 
376
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
308
377
 
309
378
        # Out of date branched standalone branch will not be detected
310
379
        out, err = self.run_bzr('info -v branch')
311
380
        self.assertEqualDiff(
312
 
"""Standalone tree (format: weave)
 
381
"""Standalone tree (format: knit)
313
382
Location:
314
383
  branch root: branch
315
384
 
318
387
  parent branch: standalone
319
388
 
320
389
Format:
321
 
       control: All-in-one format 6
322
 
  working tree: Working tree format 2
323
 
        branch: Branch format 4
324
 
    repository: Weave repository format 6
 
390
       control: Meta directory format 1
 
391
  working tree: Working tree format 3
 
392
        branch: Branch format 5
 
393
    repository: Knit repository format 1
 
394
 
 
395
Control directory:
 
396
         1 branches
325
397
 
326
398
In the working tree:
327
399
         1 unchanged
335
407
 
336
408
Branch history:
337
409
         1 revision
338
 
         1 committer
339
410
         0 days old
340
411
   first revision: %s
341
412
  latest revision: %s
342
413
 
343
414
Repository:
344
415
         1 revision
345
 
         0 KiB
346
416
""" % (datestring_first, datestring_first,
347
417
       ), out)
348
418
        self.assertEqual('', err)
364
434
        branch: Branch format 5
365
435
    repository: %s
366
436
 
 
437
Control directory:
 
438
         1 branches
 
439
 
367
440
Branch is out of date: missing 1 revision.
368
441
 
369
442
In the working tree:
372
445
         0 added
373
446
         0 removed
374
447
         0 renamed
375
 
         1 unknown
 
448
         0 unknown
376
449
         0 ignored
377
450
         0 versioned subdirectories
378
451
 
379
452
Branch history:
380
453
         1 revision
381
 
         1 committer
382
454
         0 days old
383
455
   first revision: %s
384
456
  latest revision: %s
385
457
 
386
458
Repository:
387
459
         1 revision
388
 
         %d KiB
389
460
""" % (branch3.repository._format.get_format_description(),
390
461
       datestring_first, datestring_first,
391
 
       # poking at _revision_store isn't all that clean, but neither is
392
 
       # having the ui test dependent on the exact overhead of a given store.
393
 
       branch3.repository._revision_store.total_size(
394
 
        branch3.repository.get_transaction())[1] / 1024,
395
462
       ), out)
396
463
        self.assertEqual('', err)
397
464
 
409
476
        branch: Branch format 5
410
477
    repository: %s
411
478
 
 
479
Control directory:
 
480
         1 branches
 
481
 
412
482
Branch is out of date: missing 1 revision.
413
483
 
414
484
In the working tree:
423
493
 
424
494
Branch history:
425
495
         1 revision
426
 
         1 committer
427
496
         0 days old
428
497
   first revision: %s
429
498
  latest revision: %s
430
499
 
431
500
Repository:
432
501
         1 revision
433
 
         %d KiB
434
502
""" % (branch4.repository._format.get_format_description(),
435
503
       datestring_first, datestring_first,
436
 
       # poking at _revision_store isn't all that clean, but neither is
437
 
       # having the ui test dependent on the exact overhead of a given store.
438
 
       branch4.repository._revision_store.total_size(
439
 
        branch4.repository.get_transaction())[1] / 1024,
440
504
       ), out)
441
505
        self.assertEqual('', err)
442
506
 
443
507
        # Out of date lightweight checkout
444
508
        out, err = self.run_bzr('info lightcheckout --verbose')
445
509
        self.assertEqualDiff(
446
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
447
 
pack-0.92 or rich-root or rich-root-pack)
 
510
"""Lightweight checkout (format: %s)
448
511
Location:
449
512
  light checkout root: lightcheckout
450
513
   checkout of branch: standalone
451
514
 
452
515
Format:
453
516
       control: Meta directory format 1
454
 
  working tree: Working tree format 4
455
 
        branch: Branch format 4
456
 
    repository: Weave repository format 6
 
517
  working tree: Working tree format 3
 
518
        branch: Branch format 5
 
519
    repository: Knit repository format 1
 
520
 
 
521
Control directory:
 
522
         1 branches
457
523
 
458
524
Working tree is out of date: missing 1 revision.
459
525
 
469
535
 
470
536
Branch history:
471
537
         2 revisions
472
 
         1 committer
473
538
         0 days old
474
539
   first revision: %s
475
540
  latest revision: %s
476
541
 
477
542
Repository:
478
543
         2 revisions
479
 
         0 KiB
480
 
""" % (datestring_first, datestring_last,), out)
 
544
""" % (format_description, datestring_first, datestring_last,), out)
481
545
        self.assertEqual('', err)
482
546
 
483
547
    def test_info_standalone_no_tree(self):
484
548
        # create standalone branch without a working tree
485
 
        format = bzrdir.format_registry.make_bzrdir('default')
 
549
        format = controldir.format_registry.make_bzrdir('default')
486
550
        branch = self.make_branch('branch')
487
551
        repo = branch.repository
488
552
        out, err = self.run_bzr('info branch -v')
496
560
        branch: %s
497
561
    repository: %s
498
562
 
 
563
Control directory:
 
564
         1 branches
 
565
 
499
566
Branch history:
500
567
         0 revisions
501
 
         0 committers
502
568
 
503
569
Repository:
504
570
         0 revisions
505
 
         0 KiB
506
571
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
507
572
       format.get_branch_format().get_format_description(),
508
573
       format.repository_format.get_format_description(),
510
575
        self.assertEqual('', err)
511
576
 
512
577
    def test_info_shared_repository(self):
513
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
578
        format = controldir.format_registry.make_bzrdir('knit')
514
579
        transport = self.get_transport()
515
580
 
516
581
        # Create shared repository
526
591
       control: Meta directory format 1
527
592
    repository: %s
528
593
 
 
594
Control directory:
 
595
         0 branches
 
596
 
529
597
Repository:
530
598
         0 revisions
531
 
         0 KiB
532
599
""" % ('repo', format.repository_format.get_format_description(),
533
600
       ), out)
534
601
        self.assertEqual('', err)
535
602
 
536
603
        # Create branch inside shared repository
537
604
        repo.bzrdir.root_transport.mkdir('branch')
538
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
539
 
            format=format)
 
605
        branch1 = controldir.ControlDir.create_branch_convenience(
 
606
            'repo/branch', format=format)
540
607
        out, err = self.run_bzr('info -v repo/branch')
541
608
        self.assertEqualDiff(
542
609
"""Repository branch (format: dirstate or knit)
549
616
        branch: %s
550
617
    repository: %s
551
618
 
 
619
Control directory:
 
620
         1 branches
 
621
 
552
622
Branch history:
553
623
         0 revisions
554
 
         0 committers
555
624
 
556
625
Repository:
557
626
         0 revisions
558
 
         0 KiB
559
627
""" % (format.get_branch_format().get_format_description(),
560
628
       format.repository_format.get_format_description(),
561
629
       ), out)
564
632
        # Create lightweight checkout
565
633
        transport.mkdir('tree')
566
634
        transport.mkdir('tree/lightcheckout')
567
 
        tree2 = branch1.create_checkout('tree/lightcheckout', 
 
635
        tree2 = branch1.create_checkout('tree/lightcheckout',
568
636
            lightweight=True)
569
637
        branch2 = tree2.branch
570
638
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
579
647
        self.build_tree(['tree/lightcheckout/a'])
580
648
        tree2.add('a')
581
649
        tree2.commit('commit one')
582
 
        rev = repo.get_revision(branch2.revision_history()[0])
583
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
650
        rev = repo.get_revision(branch2.last_revision())
 
651
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
584
652
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
585
653
        self.assertEqualDiff(
586
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
587
 
pack-0.92 or rich-root or rich-root-pack)
 
654
"""Lightweight checkout (format: %s)
588
655
Location:
589
656
  light checkout root: tree/lightcheckout
590
657
   checkout of branch: repo/branch
592
659
 
593
660
Format:
594
661
       control: Meta directory format 1
595
 
  working tree: Working tree format 4
 
662
  working tree: Working tree format 6
596
663
        branch: %s
597
664
    repository: %s
598
665
 
 
666
Control directory:
 
667
         1 branches
 
668
 
599
669
In the working tree:
600
670
         1 unchanged
601
671
         0 modified
608
678
 
609
679
Branch history:
610
680
         1 revision
611
 
         1 committer
612
681
         0 days old
613
682
   first revision: %s
614
683
  latest revision: %s
615
684
 
616
685
Repository:
617
686
         1 revision
618
 
         %d KiB
619
 
""" % (format.get_branch_format().get_format_description(),
 
687
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
620
688
       format.repository_format.get_format_description(),
621
689
       datestring_first, datestring_first,
622
 
       # poking at _revision_store isn't all that clean, but neither is
623
 
       # having the ui test dependent on the exact overhead of a given store.
624
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
625
690
       ), out)
626
691
        self.assertEqual('', err)
627
692
 
628
693
        # Out of date checkout
629
694
        out, err = self.run_bzr('info -v tree/checkout')
630
695
        self.assertEqualDiff(
631
 
"""Checkout (format: dirstate)
 
696
"""Checkout (format: unnamed)
632
697
Location:
633
698
       checkout root: tree/checkout
634
699
  checkout of branch: repo/branch
635
700
 
636
701
Format:
637
702
       control: Meta directory format 1
638
 
  working tree: Working tree format 4
 
703
  working tree: Working tree format 6
639
704
        branch: %s
640
705
    repository: %s
641
706
 
 
707
Control directory:
 
708
         1 branches
 
709
 
642
710
Branch is out of date: missing 1 revision.
643
711
 
644
712
In the working tree:
653
721
 
654
722
Branch history:
655
723
         0 revisions
656
 
         0 committers
657
724
 
658
725
Repository:
659
726
         0 revisions
660
 
         0 KiB
661
727
""" % (format.get_branch_format().get_format_description(),
662
728
       format.repository_format.get_format_description(),
663
729
       ), out)
669
735
        tree3.add('b')
670
736
        out, err = self.run_bzr('info tree/checkout --verbose')
671
737
        self.assertEqualDiff(
672
 
"""Checkout (format: dirstate)
 
738
"""Checkout (format: unnamed)
673
739
Location:
674
740
       checkout root: tree/checkout
675
741
  checkout of branch: repo/branch
676
742
 
677
743
Format:
678
744
       control: Meta directory format 1
679
 
  working tree: Working tree format 4
 
745
  working tree: Working tree format 6
680
746
        branch: %s
681
747
    repository: %s
682
748
 
 
749
Control directory:
 
750
         1 branches
 
751
 
683
752
In the working tree:
684
753
         1 unchanged
685
754
         0 modified
692
761
 
693
762
Branch history:
694
763
         1 revision
695
 
         1 committer
696
764
         0 days old
697
765
   first revision: %s
698
766
  latest revision: %s
699
767
 
700
768
Repository:
701
769
         1 revision
702
 
         %d KiB
703
770
""" % (format.get_branch_format().get_format_description(),
704
771
       format.repository_format.get_format_description(),
705
772
       datestring_first, datestring_first,
706
 
       # poking at _revision_store isn't all that clean, but neither is
707
 
       # having the ui test dependent on the exact overhead of a given store.
708
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
709
773
       ), out)
710
774
        self.assertEqual('', err)
711
775
        tree3.commit('commit two')
712
776
 
713
777
        # Out of date lightweight checkout
714
 
        rev = repo.get_revision(branch1.revision_history()[-1])
715
 
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
778
        rev = repo.get_revision(branch1.last_revision())
 
779
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
716
780
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
717
781
        self.assertEqualDiff(
718
 
"""Lightweight checkout (format: dirstate or dirstate-tags or \
719
 
pack-0.92 or rich-root or rich-root-pack)
 
782
"""Lightweight checkout (format: %s)
720
783
Location:
721
784
  light checkout root: tree/lightcheckout
722
785
   checkout of branch: repo/branch
724
787
 
725
788
Format:
726
789
       control: Meta directory format 1
727
 
  working tree: Working tree format 4
 
790
  working tree: Working tree format 6
728
791
        branch: %s
729
792
    repository: %s
730
793
 
 
794
Control directory:
 
795
         1 branches
 
796
 
731
797
Working tree is out of date: missing 1 revision.
732
798
 
733
799
In the working tree:
742
808
 
743
809
Branch history:
744
810
         2 revisions
745
 
         1 committer
746
811
         0 days old
747
812
   first revision: %s
748
813
  latest revision: %s
749
814
 
750
815
Repository:
751
816
         2 revisions
752
 
         %d KiB
753
 
""" % (format.get_branch_format().get_format_description(),
 
817
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
754
818
       format.repository_format.get_format_description(),
755
819
       datestring_first, datestring_last,
756
 
       # poking at _revision_store isn't all that clean, but neither is
757
 
       # having the ui test dependent on the exact overhead of a given store.
758
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
759
820
       ), out)
760
821
        self.assertEqual('', err)
761
822
 
772
833
        branch: %s
773
834
    repository: %s
774
835
 
 
836
Control directory:
 
837
         1 branches
 
838
 
775
839
Branch history:
776
840
         2 revisions
777
 
         1 committer
778
841
         0 days old
779
842
   first revision: %s
780
843
  latest revision: %s
781
844
 
782
845
Repository:
783
846
         2 revisions
784
 
         %d KiB
785
847
""" % (format.get_branch_format().get_format_description(),
786
848
       format.repository_format.get_format_description(),
787
849
       datestring_first, datestring_last,
788
 
       # poking at _revision_store isn't all that clean, but neither is
789
 
       # having the ui test dependent on the exact overhead of a given store.
790
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
791
850
       ), out)
792
851
        self.assertEqual('', err)
793
852
 
802
861
       control: Meta directory format 1
803
862
    repository: %s
804
863
 
 
864
Control directory:
 
865
         0 branches
 
866
 
805
867
Repository:
806
868
         2 revisions
807
 
         %d KiB
808
869
""" % (format.repository_format.get_format_description(),
809
 
       # poking at _revision_store isn't all that clean, but neither is
810
 
       # having the ui test dependent on the exact overhead of a given store.
811
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
812
870
       ), out)
813
871
        self.assertEqual('', err)
814
872
 
815
873
    def test_info_shared_repository_with_trees(self):
816
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
874
        format = controldir.format_registry.make_bzrdir('knit')
817
875
        transport = self.get_transport()
818
876
 
819
877
        # Create shared repository with working trees
829
887
       control: Meta directory format 1
830
888
    repository: %s
831
889
 
 
890
Control directory:
 
891
         0 branches
 
892
 
832
893
Create working tree for new branches inside the repository.
833
894
 
834
895
Repository:
835
896
         0 revisions
836
 
         0 KiB
837
897
""" % (format.repository_format.get_format_description(),
838
898
       ), out)
839
899
        self.assertEqual('', err)
840
900
 
841
901
        # Create two branches
842
902
        repo.bzrdir.root_transport.mkdir('branch1')
843
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
 
903
        branch1 = controldir.ControlDir.create_branch_convenience('repo/branch1',
844
904
            format=format)
845
905
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
846
906
 
858
918
        branch: %s
859
919
    repository: %s
860
920
 
 
921
Control directory:
 
922
         1 branches
 
923
 
861
924
In the working tree:
862
925
         0 unchanged
863
926
         0 modified
870
933
 
871
934
Branch history:
872
935
         0 revisions
873
 
         0 committers
874
936
 
875
937
Repository:
876
938
         0 revisions
877
 
         0 KiB
878
939
""" % (format.get_branch_format().get_format_description(),
879
940
       format.repository_format.get_format_description(),
880
941
       ), out)
885
946
        tree1 = branch1.bzrdir.open_workingtree()
886
947
        tree1.add('a')
887
948
        tree1.commit('commit one')
888
 
        rev = repo.get_revision(branch1.revision_history()[0])
889
 
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
949
        rev = repo.get_revision(branch1.last_revision())
 
950
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
890
951
        out, err = self.run_bzr('info -v repo/branch1')
891
952
        self.assertEqualDiff(
892
953
"""Repository tree (format: knit)
900
961
        branch: %s
901
962
    repository: %s
902
963
 
 
964
Control directory:
 
965
         1 branches
 
966
 
903
967
In the working tree:
904
968
         1 unchanged
905
969
         0 modified
912
976
 
913
977
Branch history:
914
978
         1 revision
915
 
         1 committer
916
979
         0 days old
917
980
   first revision: %s
918
981
  latest revision: %s
919
982
 
920
983
Repository:
921
984
         1 revision
922
 
         %d KiB
923
985
""" % (format.get_branch_format().get_format_description(),
924
986
       format.repository_format.get_format_description(),
925
987
       datestring_first, datestring_first,
926
 
       # poking at _revision_store isn't all that clean, but neither is
927
 
       # having the ui test dependent on the exact overhead of a given store.
928
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
929
988
       ), out)
930
989
        self.assertEqual('', err)
931
990
 
946
1005
        branch: %s
947
1006
    repository: %s
948
1007
 
 
1008
Control directory:
 
1009
         1 branches
 
1010
 
949
1011
In the working tree:
950
1012
         0 unchanged
951
1013
         0 modified
958
1020
 
959
1021
Branch history:
960
1022
         0 revisions
961
 
         0 committers
962
1023
 
963
1024
Repository:
964
1025
         1 revision
965
 
         %d KiB
966
1026
""" % (format.get_branch_format().get_format_description(),
967
1027
       format.repository_format.get_format_description(),
968
 
       # poking at _revision_store isn't all that clean, but neither is
969
 
       # having the ui test dependent on the exact overhead of a given store.
970
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
971
1028
       ), out)
972
1029
        self.assertEqual('', err)
973
1030
 
990
1047
        branch: %s
991
1048
    repository: %s
992
1049
 
 
1050
Control directory:
 
1051
         1 branches
 
1052
 
993
1053
In the working tree:
994
1054
         1 unchanged
995
1055
         0 modified
1002
1062
 
1003
1063
Branch history:
1004
1064
         1 revision
1005
 
         1 committer
1006
1065
         0 days old
1007
1066
   first revision: %s
1008
1067
  latest revision: %s
1009
1068
 
1010
1069
Repository:
1011
1070
         1 revision
1012
 
         %d KiB
1013
1071
""" % (format.get_branch_format().get_format_description(),
1014
1072
       format.repository_format.get_format_description(),
1015
1073
       datestring_first, datestring_first,
1016
 
       # poking at _revision_store isn't all that clean, but neither is
1017
 
       # having the ui test dependent on the exact overhead of a given store.
1018
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1019
1074
       ), out)
1020
1075
        self.assertEqual('', err)
1021
1076
 
1030
1085
       control: Meta directory format 1
1031
1086
    repository: %s
1032
1087
 
 
1088
Control directory:
 
1089
         0 branches
 
1090
 
1033
1091
Create working tree for new branches inside the repository.
1034
1092
 
1035
1093
Repository:
1036
1094
         1 revision
1037
 
         %d KiB
1038
1095
""" % (format.repository_format.get_format_description(),
1039
 
       # poking at _revision_store isn't all that clean, but neither is
1040
 
       # having the ui test dependent on the exact overhead of a given store.
1041
 
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1042
1096
       ),
1043
1097
       out)
1044
1098
        self.assertEqual('', err)
1045
 
    
 
1099
 
1046
1100
    def test_info_shared_repository_with_tree_in_root(self):
1047
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
1101
        format = controldir.format_registry.make_bzrdir('knit')
1048
1102
        transport = self.get_transport()
1049
1103
 
1050
1104
        # Create shared repository with working trees
1060
1114
       control: Meta directory format 1
1061
1115
    repository: %s
1062
1116
 
 
1117
Control directory:
 
1118
         0 branches
 
1119
 
1063
1120
Create working tree for new branches inside the repository.
1064
1121
 
1065
1122
Repository:
1066
1123
         0 revisions
1067
 
         0 KiB
1068
1124
""" % (format.repository_format.get_format_description(),
1069
1125
       ), out)
1070
1126
        self.assertEqual('', err)
1086
1142
        branch: %s
1087
1143
    repository: %s
1088
1144
 
 
1145
Control directory:
 
1146
         1 branches
 
1147
 
1089
1148
In the working tree:
1090
1149
         0 unchanged
1091
1150
         0 modified
1098
1157
 
1099
1158
Branch history:
1100
1159
         0 revisions
1101
 
         0 committers
1102
1160
 
1103
1161
Repository:
1104
1162
         0 revisions
1105
 
         0 KiB
1106
1163
""" % (format.get_branch_format().get_format_description(),
1107
1164
       format.repository_format.get_format_description(),
1108
1165
       ), out)
1109
1166
        self.assertEqual('', err)
1110
1167
 
 
1168
    def test_info_repository_hook(self):
 
1169
        format = controldir.format_registry.make_bzrdir('knit')
 
1170
        def repo_info(repo, stats, outf):
 
1171
            outf.write("more info\n")
 
1172
        info.hooks.install_named_hook('repository', repo_info, None)
 
1173
        # Create shared repository with working trees
 
1174
        repo = self.make_repository('repo', shared=True, format=format)
 
1175
        out, err = self.run_bzr('info -v repo')
 
1176
        self.assertEqualDiff(
 
1177
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
 
1178
Location:
 
1179
  shared repository: repo
 
1180
 
 
1181
Format:
 
1182
       control: Meta directory format 1
 
1183
    repository: %s
 
1184
 
 
1185
Control directory:
 
1186
         0 branches
 
1187
 
 
1188
Create working tree for new branches inside the repository.
 
1189
 
 
1190
Repository:
 
1191
         0 revisions
 
1192
more info
 
1193
""" % (format.repository_format.get_format_description(),
 
1194
       ), out)
 
1195
        self.assertEqual('', err)
 
1196
 
 
1197
    def test_info_unshared_repository_with_colocated_branches(self):
 
1198
        format = controldir.format_registry.make_bzrdir('development-colo')
 
1199
        transport = self.get_transport()
 
1200
 
 
1201
        # Create unshared repository
 
1202
        repo = self.make_repository('repo', shared=False, format=format)
 
1203
        repo.set_make_working_trees(True)
 
1204
        repo.bzrdir.create_branch(name='foo')
 
1205
        out, err = self.run_bzr('info repo')
 
1206
        self.assertEqualDiff(
 
1207
"""Unshared repository with trees and colocated branches (format: development-colo)
 
1208
Location:
 
1209
  repository: repo
 
1210
""", out)
 
1211
        self.assertEqual('', err)
 
1212
 
1111
1213
    def assertCheckoutStatusOutput(self,
1112
1214
        command_string, lco_tree, shared_repo=None,
1113
1215
        repo_branch=None,
1123
1225
        allow us, the test writers, to document what *should* be present in
1124
1226
        the output. Removing this separation would remove the value of the
1125
1227
        tests.
1126
 
        
 
1228
 
1127
1229
        :param path: the path to the light checkout.
1128
1230
        :param lco_tree: the tree object for the light checkout.
1129
1231
        :param shared_repo: A shared repository is in use, expect that in
1137
1239
            actually locked then this parameter is overridden. This is because
1138
1240
            pack repositories do not have any public API for obtaining an
1139
1241
            exclusive repository wide lock.
1140
 
        :param verbose: If true, expect verbose output
 
1242
        :param verbose: verbosity level: 2 or higher to show committers
1141
1243
        """
1142
1244
        def friendly_location(url):
1143
1245
            path = urlutils.unescape_for_display(url, 'ascii')
1146
1248
            except errors.PathNotChild:
1147
1249
                return path
1148
1250
 
1149
 
        if tree_locked and sys.platform == 'win32':
1150
 
            # We expect this to fail because of locking errors. (A write-locked
1151
 
            # file cannot be read-locked in the same process).
 
1251
        if tree_locked:
 
1252
            # We expect this to fail because of locking errors.
 
1253
            # (A write-locked file cannot be read-locked
 
1254
            # in the different process -- either on win32 or on linux).
1152
1255
            # This should be removed when the locking errors are fixed.
1153
 
            self.run_bzr_error([], 'info ' + command_string)
1154
 
            return
 
1256
            self.expectFailure('OS locks are exclusive '
 
1257
                'for different processes (Bug #174055)',
 
1258
                self.run_bzr_subprocess,
 
1259
                'info ' + command_string)
1155
1260
        out, err = self.run_bzr('info %s' % command_string)
1156
1261
        description = {
1157
1262
            (True, True): 'Lightweight checkout',
1159
1264
            (False, True): 'Lightweight checkout',
1160
1265
            (False, False): 'Checkout',
1161
1266
            }[(shared_repo is not None, light_checkout)]
1162
 
        format = {True: 'dirstate or dirstate-tags or pack-0.92'
1163
 
                        ' or rich-root or rich-root-pack',
1164
 
                  False: 'dirstate'}[light_checkout]
 
1267
        format = {True: self._repo_strings,
 
1268
                  False: 'unnamed'}[light_checkout]
1165
1269
        if repo_locked:
1166
1270
            repo_locked = lco_tree.branch.repository.get_physical_lock_status()
1167
1271
        if repo_locked or branch_locked or tree_locked:
1204
1308
        else:
1205
1309
            branch_data = ("   checkout of branch: %s\n" %
1206
1310
                lco_tree.branch.bzrdir.root_transport.base)
1207
 
        
1208
 
        if verbose:
 
1311
 
 
1312
        if verbose >= 2:
1209
1313
            verbose_info = '         0 committers\n'
1210
1314
        else:
1211
1315
            verbose_info = ''
1212
 
            
 
1316
 
1213
1317
        self.assertEqualDiff(
1214
1318
"""%s (format: %s)
1215
1319
Location:
1220
1324
        branch: %s
1221
1325
    repository: %s
1222
1326
%s
 
1327
Control directory:
 
1328
         1 branches
 
1329
 
1223
1330
In the working tree:
1224
1331
         0 unchanged
1225
1332
         0 modified
1235
1342
%s
1236
1343
Repository:
1237
1344
         0 revisions
1238
 
         0 KiB
1239
1345
""" %  (description,
1240
1346
        format,
1241
1347
        tree_data,
1252
1358
        transport = self.get_transport()
1253
1359
        # Create shared repository with a branch
1254
1360
        repo = self.make_repository('repo', shared=True,
1255
 
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1361
                                    format=bzrdir.BzrDirMetaFormat1())
1256
1362
        repo.set_make_working_trees(False)
1257
1363
        repo.bzrdir.root_transport.mkdir('branch')
1258
 
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1259
 
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1364
        repo_branch = controldir.ControlDir.create_branch_convenience(
 
1365
            'repo/branch', format=bzrdir.BzrDirMetaFormat1())
1260
1366
        # Do a heavy checkout
1261
1367
        transport.mkdir('tree')
1262
1368
        transport.mkdir('tree/checkout')
1263
 
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1264
 
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1369
        co_branch = controldir.ControlDir.create_branch_convenience(
 
1370
            'tree/checkout', format=bzrdir.BzrDirMetaFormat1())
1265
1371
        co_branch.bind(repo_branch)
1266
1372
        # Do a light checkout of the heavy one
1267
1373
        transport.mkdir('tree/lightcheckout')
1268
 
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1269
 
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
 
1374
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1375
        lco_dir.set_branch_reference(co_branch)
1270
1376
        lco_dir.create_workingtree()
1271
1377
        lco_tree = lco_dir.open_workingtree()
1272
1378
 
1360
1466
            self.knownFailure('Win32 cannot run "bzr info"'
1361
1467
                              ' when the tree is locked.')
1362
1468
 
1363
 
    def test_info_locking_oslocks(self):
1364
 
        if sys.platform == "win32":
1365
 
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1366
 
 
1367
 
        tree = self.make_branch_and_tree('branch',
1368
 
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1369
 
 
1370
 
        # Test all permutations of locking the working tree, branch and repository
1371
 
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1372
 
        # implemented by raising NotImplementedError and get_physical_lock_status()
1373
 
        # always returns false. This makes bzr info hide the lock status.  (Olaf)
1374
 
        # W B R
1375
 
 
1376
 
        # U U U
1377
 
        out, err = self.run_bzr('info -v branch')
1378
 
        self.assertEqualDiff(
1379
 
"""Standalone tree (format: weave)
1380
 
Location:
1381
 
  branch root: %s
1382
 
 
1383
 
Format:
1384
 
       control: All-in-one format 6
1385
 
  working tree: Working tree format 2
1386
 
        branch: Branch format 4
1387
 
    repository: %s
1388
 
 
1389
 
In the working tree:
1390
 
         0 unchanged
1391
 
         0 modified
1392
 
         0 added
1393
 
         0 removed
1394
 
         0 renamed
1395
 
         0 unknown
1396
 
         0 ignored
1397
 
         0 versioned subdirectories
1398
 
 
1399
 
Branch history:
1400
 
         0 revisions
1401
 
         0 committers
1402
 
 
1403
 
Repository:
1404
 
         0 revisions
1405
 
         0 KiB
1406
 
""" % ('branch', tree.branch.repository._format.get_format_description(),
1407
 
       ), out)
1408
 
        self.assertEqual('', err)
1409
 
        # L L L
1410
 
        tree.lock_write()
1411
 
        out, err = self.run_bzr('info -v branch')
1412
 
        self.assertEqualDiff(
1413
 
"""Standalone tree (format: weave)
1414
 
Location:
1415
 
  branch root: %s
1416
 
 
1417
 
Format:
1418
 
       control: All-in-one format 6
1419
 
  working tree: Working tree format 2
1420
 
        branch: Branch format 4
1421
 
    repository: %s
1422
 
 
1423
 
In the working tree:
1424
 
         0 unchanged
1425
 
         0 modified
1426
 
         0 added
1427
 
         0 removed
1428
 
         0 renamed
1429
 
         0 unknown
1430
 
         0 ignored
1431
 
         0 versioned subdirectories
1432
 
 
1433
 
Branch history:
1434
 
         0 revisions
1435
 
         0 committers
1436
 
 
1437
 
Repository:
1438
 
         0 revisions
1439
 
         0 KiB
1440
 
""" % ('branch', tree.branch.repository._format.get_format_description(),
1441
 
       ), out)
1442
 
        self.assertEqual('', err)
1443
 
        tree.unlock()
 
1469
    def test_info_stacked(self):
 
1470
        # We have a mainline
 
1471
        trunk_tree = self.make_branch_and_tree('mainline',
 
1472
            format='1.6')
 
1473
        trunk_tree.commit('mainline')
 
1474
        # and a branch from it which is stacked
 
1475
        new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
 
1476
        out, err = self.run_bzr('info newbranch')
 
1477
        self.assertEqual(
 
1478
"""Standalone tree (format: 1.6)
 
1479
Location:
 
1480
  branch root: newbranch
 
1481
 
 
1482
Related branches:
 
1483
  parent branch: mainline
 
1484
     stacked on: mainline
 
1485
""", out)
 
1486
        self.assertEqual("", err)
 
1487
 
 
1488
    def test_info_revinfo_optional(self):
 
1489
        tree = self.make_branch_and_tree('.')
 
1490
        def last_revision_info(self):
 
1491
            raise errors.UnsupportedOperation(last_revision_info, self)
 
1492
        self.overrideAttr(
 
1493
            branch.Branch, "last_revision_info", last_revision_info)
 
1494
        out, err = self.run_bzr('info -v .')
 
1495
        self.assertEqual(
 
1496
"""Standalone tree (format: 2a)
 
1497
Location:
 
1498
  branch root: .
 
1499
 
 
1500
Format:
 
1501
       control: Meta directory format 1
 
1502
  working tree: Working tree format 6
 
1503
        branch: Branch format 7
 
1504
    repository: Repository format 2a - rich roots, group compression and chk inventories
 
1505
 
 
1506
Control directory:
 
1507
         1 branches
 
1508
 
 
1509
In the working tree:
 
1510
         0 unchanged
 
1511
         0 modified
 
1512
         0 added
 
1513
         0 removed
 
1514
         0 renamed
 
1515
         0 unknown
 
1516
         0 ignored
 
1517
         0 versioned subdirectories
 
1518
""", out)
 
1519
        self.assertEqual("", err)
 
1520
 
 
1521
    def test_info_shows_colocated_branches(self):
 
1522
        bzrdir = self.make_branch('.', format='development-colo').bzrdir
 
1523
        bzrdir.create_branch(name="colo1")
 
1524
        bzrdir.create_branch(name="colo2")
 
1525
        bzrdir.create_branch(name="colo3")
 
1526
        out, err = self.run_bzr('info -v .')
 
1527
        self.assertEqualDiff(
 
1528
"""Standalone branch (format: development-colo)
 
1529
Location:
 
1530
  branch root: .
 
1531
 
 
1532
Format:
 
1533
       control: Meta directory format 1 with support for colocated branches
 
1534
        branch: Branch format 7
 
1535
    repository: Repository format 2a - rich roots, group compression and chk inventories
 
1536
 
 
1537
Control directory:
 
1538
         4 branches
 
1539
 
 
1540
Branch history:
 
1541
         0 revisions
 
1542
 
 
1543
Repository:
 
1544
         0 revisions
 
1545
""", out)
 
1546
        self.assertEqual("", err)
 
1547
 
 
1548
 
 
1549
class TestSmartServerInfo(tests.TestCaseWithTransport):
 
1550
 
 
1551
    def test_simple_branch_info(self):
 
1552
        self.setup_smart_server_with_call_log()
 
1553
        t = self.make_branch_and_tree('branch')
 
1554
        self.build_tree_contents([('branch/foo', 'thecontents')])
 
1555
        t.add("foo")
 
1556
        t.commit("message")
 
1557
        self.reset_smart_call_log()
 
1558
        out, err = self.run_bzr(['info', self.get_url('branch')])
 
1559
        # This figure represent the amount of work to perform this use case. It
 
1560
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
1561
        # being too low. If rpc_count increases, more network roundtrips have
 
1562
        # become necessary for this use case. Please do not adjust this number
 
1563
        # upwards without agreement from bzr's network support maintainers.
 
1564
        self.assertLength(10, self.hpss_calls)
 
1565
        self.assertLength(1, self.hpss_connections)
 
1566
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)
 
1567
 
 
1568
    def test_verbose_branch_info(self):
 
1569
        self.setup_smart_server_with_call_log()
 
1570
        t = self.make_branch_and_tree('branch')
 
1571
        self.build_tree_contents([('branch/foo', 'thecontents')])
 
1572
        t.add("foo")
 
1573
        t.commit("message")
 
1574
        self.reset_smart_call_log()
 
1575
        out, err = self.run_bzr(['info', '-v', self.get_url('branch')])
 
1576
        # This figure represent the amount of work to perform this use case. It
 
1577
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
1578
        # being too low. If rpc_count increases, more network roundtrips have
 
1579
        # become necessary for this use case. Please do not adjust this number
 
1580
        # upwards without agreement from bzr's network support maintainers.
 
1581
        self.assertLength(14, self.hpss_calls)
 
1582
        self.assertLength(1, self.hpss_connections)
 
1583
        self.assertThat(self.hpss_calls, ContainsNoVfsCalls)