~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: 2006-08-17 13:49:05 UTC
  • mfrom: (1711.2.129 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060817134905-0dec610d2fcd6663
(bialix) 'make html-docs' produces html documentation

Show diffs side-by-side

added added

removed removed

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