~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-10-24 12:49:17 UTC
  • mfrom: (2935.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20071024124917-xb75eckyxx6vkrlg
Makefile fixes - hooks.html generation & allow python to be overridden (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

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