~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Wouter van Heyst
  • Date: 2006-06-07 16:05:27 UTC
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: larstiq@larstiq.dyndns.org-20060607160527-2b3649154d0e2e84
more code cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
2
 
#
 
1
# Copyright (C) 2006 by Canonical Ltd
 
2
# -*- coding: utf-8 -*-
 
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
5
6
# the Free Software Foundation; either version 2 of the License, or
6
7
# (at your option) any later version.
7
 
#
 
8
 
8
9
# This program is distributed in the hope that it will be useful,
9
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
12
# GNU General Public License for more details.
12
 
#
 
13
 
13
14
# You should have received a copy of the GNU General Public License
14
15
# along with this program; if not, write to the Free Software
15
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
18
 
18
19
"""Tests for the info command of bzr."""
19
20
 
20
 
import sys
21
21
 
22
22
import bzrlib
23
 
from bzrlib import (
24
 
    bzrdir,
25
 
    repository,
26
 
    )
 
23
 
 
24
 
27
25
from bzrlib.osutils import format_date
28
26
from bzrlib.tests import TestSkipped
29
27
from bzrlib.tests.blackbox import ExternalBase
32
30
class TestInfo(ExternalBase):
33
31
 
34
32
    def test_info_non_existing(self):
35
 
        if sys.platform == "win32":
36
 
            location = "C:/i/do/not/exist/"
37
 
        else:
38
 
            location = "/i/do/not/exist/"
39
 
        out, err = self.run_bzr('info '+location, retcode=3)
 
33
        out, err = self.runbzr('info /i/do/not/exist/', retcode=3)
40
34
        self.assertEqual(out, '')
41
 
        self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
 
35
        self.assertEqual(err, 'bzr: ERROR: Not a branch: /i/do/not/exist/\n')
42
36
 
43
37
    def test_info_standalone(self):
44
38
        transport = self.get_transport()
45
39
 
46
40
        # Create initial standalone branch
47
 
        tree1 = self.make_branch_and_tree('standalone', 'weave')
 
41
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
42
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirFormat6())
 
43
        tree1 = self.make_branch_and_tree('standalone')
 
44
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
48
45
        self.build_tree(['standalone/a'])
49
46
        tree1.add('a')
50
47
        branch1 = tree1.branch
51
 
        out, err = self.run_bzr('info standalone -v')
 
48
        out, err = self.runbzr('info standalone')
52
49
        self.assertEqualDiff(
53
 
"""Standalone tree (format: weave)
54
 
Location:
 
50
"""Location:
55
51
  branch root: %s
56
52
 
57
53
Format:
72
68
 
73
69
Branch history:
74
70
         0 revisions
75
 
         0 committers
76
71
 
77
 
Repository:
 
72
Revision store:
78
73
         0 revisions
79
74
         0 KiB
80
75
""" % branch1.bzrdir.root_transport.base, out)
86
81
        # Branch standalone with push location
87
82
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
88
83
        branch2.set_push_location(branch1.bzrdir.root_transport.base)
89
 
        out, err = self.run_bzr('info branch --verbose')
 
84
        out, err = self.runbzr('info branch --verbose')
90
85
        self.assertEqualDiff(
91
 
"""Standalone tree (format: weave)
92
 
Location:
 
86
"""Location:
93
87
  branch root: %s
94
88
 
95
89
Related branches:
119
113
   first revision: %s
120
114
  latest revision: %s
121
115
 
122
 
Repository:
 
116
Revision store:
123
117
         1 revision
124
118
         %d KiB
125
119
""" % (branch2.bzrdir.root_transport.base,
136
130
        # Branch and bind to standalone, needs upgrade to metadir
137
131
        # (creates backup as unknown)
138
132
        branch1.bzrdir.sprout('bound')
139
 
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
140
 
        bzrlib.upgrade.upgrade('bound', knit1_format)
 
133
        bzrlib.upgrade.upgrade('bound', bzrlib.bzrdir.BzrDirMetaFormat1())
141
134
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
142
135
        branch3.bind(branch1)
143
 
        bound_tree = branch3.bzrdir.open_workingtree()
144
 
        out, err = self.run_bzr('info -v bound')
 
136
        out, err = self.runbzr('info bound')
145
137
        self.assertEqualDiff(
146
 
"""Checkout (format: knit)
147
 
Location:
 
138
"""Location:
148
139
       checkout root: %s
149
140
  checkout of branch: %s
150
141
 
153
144
 
154
145
Format:
155
146
       control: Meta directory format 1
156
 
  working tree: %s
157
 
        branch: %s
 
147
  working tree: Working tree format 3
 
148
        branch: Branch format 5
158
149
    repository: %s
159
150
 
160
151
In the working tree:
169
160
 
170
161
Branch history:
171
162
         1 revision
172
 
         1 committer
173
163
         0 days old
174
164
   first revision: %s
175
165
  latest revision: %s
176
166
 
177
 
Repository:
 
167
Revision store:
178
168
         1 revision
179
169
         %d KiB
180
170
""" % (branch3.bzrdir.root_transport.base,
181
171
       branch1.bzrdir.root_transport.base,
182
172
       branch1.bzrdir.root_transport.base,
183
 
       bound_tree._format.get_format_description(),      
184
 
       branch3._format.get_format_description(),
185
173
       branch3.repository._format.get_format_description(),
186
174
       datestring_first, datestring_first,
187
175
       # poking at _revision_store isn't all that clean, but neither is
192
180
        self.assertEqual('', err)
193
181
 
194
182
        # Checkout standalone (same as above, but does not have parent set)
195
 
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
196
 
            format=knit1_format)
 
183
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
184
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
 
185
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout')
 
186
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
197
187
        branch4.bind(branch1)
198
188
        branch4.bzrdir.open_workingtree().update()
199
 
        out, err = self.run_bzr('info checkout --verbose')
 
189
        out, err = self.runbzr('info checkout --verbose')
200
190
        self.assertEqualDiff(
201
 
"""Checkout (format: knit)
202
 
Location:
 
191
"""Location:
203
192
       checkout root: %s
204
193
  checkout of branch: %s
205
194
 
226
215
   first revision: %s
227
216
  latest revision: %s
228
217
 
229
 
Repository:
 
218
Revision store:
230
219
         1 revision
231
220
         %d KiB
232
221
""" % (branch4.bzrdir.root_transport.base,
241
230
        self.assertEqual('', err)
242
231
 
243
232
        # Lightweight checkout (same as above, different branch and repository)
244
 
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
 
233
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
234
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
 
235
        transport.mkdir('lightcheckout')
 
236
        dir5 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('lightcheckout')
 
237
        bzrlib.branch.BranchReferenceFormat().initialize(dir5, branch1)
 
238
        dir5.create_workingtree()
 
239
        tree5 = dir5.open_workingtree()
 
240
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
245
241
        branch5 = tree5.branch
246
 
        out, err = self.run_bzr('info -v lightcheckout')
 
242
        out, err = self.runbzr('info lightcheckout')
247
243
        self.assertEqualDiff(
248
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
249
 
Location:
 
244
"""Location:
250
245
  light checkout root: %s
251
246
   checkout of branch: %s
252
247
 
253
248
Format:
254
249
       control: Meta directory format 1
255
 
  working tree: Working tree format 4
 
250
  working tree: Working tree format 3
256
251
        branch: Branch format 4
257
252
    repository: Weave repository format 6
258
253
 
268
263
 
269
264
Branch history:
270
265
         1 revision
271
 
         1 committer
272
266
         0 days old
273
267
   first revision: %s
274
268
  latest revision: %s
275
269
 
276
 
Repository:
 
270
Revision store:
277
271
         1 revision
278
272
         0 KiB
279
273
""" % (tree5.bzrdir.root_transport.base,
290
284
        datestring_last = format_date(rev.timestamp, rev.timezone)
291
285
 
292
286
        # Out of date branched standalone branch will not be detected
293
 
        out, err = self.run_bzr('info -v branch')
 
287
        out, err = self.runbzr('info branch')
294
288
        self.assertEqualDiff(
295
 
"""Standalone tree (format: weave)
296
 
Location:
 
289
"""Location:
297
290
  branch root: %s
298
291
 
299
292
Related branches:
318
311
 
319
312
Branch history:
320
313
         1 revision
321
 
         1 committer
322
314
         0 days old
323
315
   first revision: %s
324
316
  latest revision: %s
325
317
 
326
 
Repository:
 
318
Revision store:
327
319
         1 revision
328
320
         0 KiB
329
321
""" % (branch2.bzrdir.root_transport.base,
334
326
        self.assertEqual('', err)
335
327
 
336
328
        # Out of date bound branch
337
 
        out, err = self.run_bzr('info -v bound')
 
329
        out, err = self.runbzr('info bound')
338
330
        self.assertEqualDiff(
339
 
"""Checkout (format: knit)
340
 
Location:
 
331
"""Location:
341
332
       checkout root: %s
342
333
  checkout of branch: %s
343
334
 
364
355
 
365
356
Branch history:
366
357
         1 revision
367
 
         1 committer
368
358
         0 days old
369
359
   first revision: %s
370
360
  latest revision: %s
371
361
 
372
 
Repository:
 
362
Revision store:
373
363
         1 revision
374
364
         %d KiB
375
365
""" % (branch3.bzrdir.root_transport.base,
385
375
        self.assertEqual('', err)
386
376
 
387
377
        # Out of date checkout
388
 
        out, err = self.run_bzr('info -v checkout')
 
378
        out, err = self.runbzr('info checkout')
389
379
        self.assertEqualDiff(
390
 
"""Checkout (format: knit)
391
 
Location:
 
380
"""Location:
392
381
       checkout root: %s
393
382
  checkout of branch: %s
394
383
 
412
401
 
413
402
Branch history:
414
403
         1 revision
415
 
         1 committer
416
404
         0 days old
417
405
   first revision: %s
418
406
  latest revision: %s
419
407
 
420
 
Repository:
 
408
Revision store:
421
409
         1 revision
422
410
         %d KiB
423
411
""" % (branch4.bzrdir.root_transport.base,
432
420
        self.assertEqual('', err)
433
421
 
434
422
        # Out of date lightweight checkout
435
 
        out, err = self.run_bzr('info lightcheckout --verbose')
 
423
        out, err = self.runbzr('info lightcheckout --verbose')
436
424
        self.assertEqualDiff(
437
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
438
 
Location:
 
425
"""Location:
439
426
  light checkout root: %s
440
427
   checkout of branch: %s
441
428
 
442
429
Format:
443
430
       control: Meta directory format 1
444
 
  working tree: Working tree format 4
 
431
  working tree: Working tree format 3
445
432
        branch: Branch format 4
446
433
    repository: Weave repository format 6
447
434
 
464
451
   first revision: %s
465
452
  latest revision: %s
466
453
 
467
 
Repository:
 
454
Revision store:
468
455
         2 revisions
469
456
         0 KiB
470
457
""" % (tree5.bzrdir.root_transport.base,
475
462
 
476
463
    def test_info_standalone_no_tree(self):
477
464
        # create standalone branch without a working tree
478
 
        format = bzrdir.format_registry.make_bzrdir('default')
479
465
        branch = self.make_branch('branch')
480
466
        repo = branch.repository
481
 
        out, err = self.run_bzr('info branch -v')
 
467
        out, err = self.runbzr('info branch')
482
468
        self.assertEqualDiff(
483
 
"""Standalone branch (format: dirstate or knit)
484
 
Location:
 
469
"""Location:
485
470
  branch root: %s
486
471
 
487
472
Format:
488
473
       control: Meta directory format 1
489
 
        branch: %s
 
474
        branch: Branch format 5
490
475
    repository: %s
491
476
 
492
477
Branch history:
493
478
         0 revisions
494
 
         0 committers
495
479
 
496
 
Repository:
 
480
Revision store:
497
481
         0 revisions
498
482
         0 KiB
499
483
""" % (branch.bzrdir.root_transport.base,
500
 
       format.get_branch_format().get_format_description(),
501
 
       format.repository_format.get_format_description(),
 
484
       repo._format.get_format_description(),
502
485
       ), out)
503
486
        self.assertEqual('', err)
504
487
 
505
488
    def test_info_shared_repository(self):
506
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
489
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
490
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
507
491
        transport = self.get_transport()
508
492
 
509
493
        # Create shared repository
510
 
        repo = self.make_repository('repo', shared=True, format=format)
 
494
        repo = self.make_repository('repo', shared=True)
511
495
        repo.set_make_working_trees(False)
512
 
        out, err = self.run_bzr('info -v repo')
 
496
        out, err = self.runbzr('info repo')
513
497
        self.assertEqualDiff(
514
 
"""Shared repository (format: dirstate or dirstate-tags or knit)
515
 
Location:
 
498
"""Location:
516
499
  shared repository: %s
517
500
 
518
501
Format:
519
502
       control: Meta directory format 1
520
503
    repository: %s
521
504
 
522
 
Repository:
 
505
Revision store:
523
506
         0 revisions
524
507
         0 KiB
525
508
""" % (repo.bzrdir.root_transport.base,
526
 
       format.repository_format.get_format_description(),
 
509
       repo._format.get_format_description(),
527
510
       ), out)
528
511
        self.assertEqual('', err)
529
512
 
530
513
        # Create branch inside shared repository
531
514
        repo.bzrdir.root_transport.mkdir('branch')
532
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
533
 
            format=format)
534
 
        out, err = self.run_bzr('info -v repo/branch')
 
515
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
 
516
        out, err = self.runbzr('info repo/branch')
535
517
        self.assertEqualDiff(
536
 
"""Repository branch (format: dirstate or knit)
537
 
Location:
 
518
"""Location:
538
519
  shared repository: %s
539
520
  repository branch: branch
540
521
 
541
522
Format:
542
523
       control: Meta directory format 1
543
 
        branch: %s
 
524
        branch: Branch format 5
544
525
    repository: %s
545
526
 
546
527
Branch history:
547
528
         0 revisions
548
 
         0 committers
549
529
 
550
 
Repository:
 
530
Revision store:
551
531
         0 revisions
552
532
         0 KiB
553
533
""" % (repo.bzrdir.root_transport.base,
554
 
       format.get_branch_format().get_format_description(),
555
 
       format.repository_format.get_format_description(),
 
534
       repo._format.get_format_description(),
556
535
       ), out)
557
536
        self.assertEqual('', err)
558
537
 
559
538
        # Create lightweight checkout
560
539
        transport.mkdir('tree')
561
540
        transport.mkdir('tree/lightcheckout')
562
 
        tree2 = branch1.create_checkout('tree/lightcheckout', 
563
 
            lightweight=True)
 
541
        dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
542
        bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
 
543
        dir2.create_workingtree()
 
544
        tree2 = dir2.open_workingtree()
564
545
        branch2 = tree2.branch
565
 
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
566
 
                   shared_repo=repo, repo_branch=branch1, verbose=True)
 
546
        out, err = self.runbzr('info tree/lightcheckout')
 
547
        self.assertEqualDiff(
 
548
"""Location:
 
549
  light checkout root: %s
 
550
    shared repository: %s
 
551
    repository branch: branch
 
552
 
 
553
Format:
 
554
       control: Meta directory format 1
 
555
  working tree: Working tree format 3
 
556
        branch: Branch format 5
 
557
    repository: %s
 
558
 
 
559
In the working tree:
 
560
         0 unchanged
 
561
         0 modified
 
562
         0 added
 
563
         0 removed
 
564
         0 renamed
 
565
         0 unknown
 
566
         0 ignored
 
567
         0 versioned subdirectories
 
568
 
 
569
Branch history:
 
570
         0 revisions
 
571
 
 
572
Revision store:
 
573
         0 revisions
 
574
         0 KiB
 
575
""" % (tree2.bzrdir.root_transport.base,
 
576
       repo.bzrdir.root_transport.base,
 
577
       repo._format.get_format_description(),
 
578
       ), out)
 
579
        self.assertEqual('', err)
567
580
 
568
581
        # Create normal checkout
569
 
        tree3 = branch1.create_checkout('tree/checkout')
570
 
        self.assertCheckoutStatusOutput('tree/checkout --verbose', tree3,
571
 
            verbose=True,
572
 
            light_checkout=False, repo_branch=branch1)
 
582
        branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
 
583
        branch3.bind(branch1)
 
584
        tree3 = branch3.bzrdir.open_workingtree()
 
585
        tree3.update()
 
586
        out, err = self.runbzr('info tree/checkout --verbose')
 
587
        self.assertEqualDiff(
 
588
"""Location:
 
589
       checkout root: %s
 
590
  checkout of branch: %s
 
591
 
 
592
Format:
 
593
       control: Meta directory format 1
 
594
  working tree: Working tree format 3
 
595
        branch: Branch format 5
 
596
    repository: %s
 
597
 
 
598
In the working tree:
 
599
         0 unchanged
 
600
         0 modified
 
601
         0 added
 
602
         0 removed
 
603
         0 renamed
 
604
         0 unknown
 
605
         0 ignored
 
606
         0 versioned subdirectories
 
607
 
 
608
Branch history:
 
609
         0 revisions
 
610
         0 committers
 
611
 
 
612
Revision store:
 
613
         0 revisions
 
614
         0 KiB
 
615
""" % (branch3.bzrdir.root_transport.base,
 
616
       branch1.bzrdir.root_transport.base,
 
617
       repo._format.get_format_description(),
 
618
       ), out)
 
619
        self.assertEqual('', err)
 
620
 
573
621
        # Update lightweight checkout
574
622
        self.build_tree(['tree/lightcheckout/a'])
575
623
        tree2.add('a')
576
624
        tree2.commit('commit one')
577
625
        rev = repo.get_revision(branch2.revision_history()[0])
578
626
        datestring_first = format_date(rev.timestamp, rev.timezone)
579
 
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
 
627
        out, err = self.runbzr('info tree/lightcheckout --verbose')
580
628
        self.assertEqualDiff(
581
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
582
 
Location:
 
629
"""Location:
583
630
  light checkout root: %s
584
 
   checkout of branch: %s
585
631
    shared repository: %s
 
632
    repository branch: branch
586
633
 
587
634
Format:
588
635
       control: Meta directory format 1
589
 
  working tree: Working tree format 4
590
 
        branch: %s
 
636
  working tree: Working tree format 3
 
637
        branch: Branch format 5
591
638
    repository: %s
592
639
 
593
640
In the working tree:
607
654
   first revision: %s
608
655
  latest revision: %s
609
656
 
610
 
Repository:
 
657
Revision store:
611
658
         1 revision
612
659
         %d KiB
613
660
""" % (tree2.bzrdir.root_transport.base,
614
 
       tree2.branch.bzrdir.root_transport.base,
615
661
       repo.bzrdir.root_transport.base,
616
 
       format.get_branch_format().get_format_description(),
617
 
       format.repository_format.get_format_description(),
 
662
       repo._format.get_format_description(),
618
663
       datestring_first, datestring_first,
619
664
       # poking at _revision_store isn't all that clean, but neither is
620
665
       # having the ui test dependent on the exact overhead of a given store.
623
668
        self.assertEqual('', err)
624
669
 
625
670
        # Out of date checkout
626
 
        out, err = self.run_bzr('info -v tree/checkout')
 
671
        out, err = self.runbzr('info tree/checkout')
627
672
        self.assertEqualDiff(
628
 
"""Checkout (format: dirstate)
629
 
Location:
 
673
"""Location:
630
674
       checkout root: %s
631
675
  checkout of branch: %s
632
676
 
633
677
Format:
634
678
       control: Meta directory format 1
635
 
  working tree: Working tree format 4
636
 
        branch: %s
 
679
  working tree: Working tree format 3
 
680
        branch: Branch format 5
637
681
    repository: %s
638
682
 
639
683
Branch is out of date: missing 1 revision.
650
694
 
651
695
Branch history:
652
696
         0 revisions
653
 
         0 committers
654
697
 
655
 
Repository:
 
698
Revision store:
656
699
         0 revisions
657
700
         0 KiB
658
701
""" % (tree3.bzrdir.root_transport.base,
659
702
       branch1.bzrdir.root_transport.base,
660
 
       format.get_branch_format().get_format_description(),
661
 
       format.repository_format.get_format_description(),
 
703
       repo._format.get_format_description(),
662
704
       ), out)
663
705
        self.assertEqual('', err)
664
706
 
666
708
        tree3.update()
667
709
        self.build_tree(['tree/checkout/b'])
668
710
        tree3.add('b')
669
 
        out, err = self.run_bzr('info tree/checkout --verbose')
 
711
        out, err = self.runbzr('info tree/checkout --verbose')
670
712
        self.assertEqualDiff(
671
 
"""Checkout (format: dirstate)
672
 
Location:
 
713
"""Location:
673
714
       checkout root: %s
674
715
  checkout of branch: %s
675
716
 
676
717
Format:
677
718
       control: Meta directory format 1
678
 
  working tree: Working tree format 4
679
 
        branch: %s
 
719
  working tree: Working tree format 3
 
720
        branch: Branch format 5
680
721
    repository: %s
681
722
 
682
723
In the working tree:
696
737
   first revision: %s
697
738
  latest revision: %s
698
739
 
699
 
Repository:
 
740
Revision store:
700
741
         1 revision
701
742
         %d KiB
702
743
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
703
 
       format.get_branch_format().get_format_description(),
704
 
       format.repository_format.get_format_description(),
 
744
       repo._format.get_format_description(),
705
745
       datestring_first, datestring_first,
706
746
       # poking at _revision_store isn't all that clean, but neither is
707
747
       # having the ui test dependent on the exact overhead of a given store.
713
753
        # Out of date lightweight checkout
714
754
        rev = repo.get_revision(branch1.revision_history()[-1])
715
755
        datestring_last = format_date(rev.timestamp, rev.timezone)
716
 
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
 
756
        out, err = self.runbzr('info tree/lightcheckout --verbose')
717
757
        self.assertEqualDiff(
718
 
"""Lightweight checkout (format: dirstate or dirstate-tags)
719
 
Location:
 
758
"""Location:
720
759
  light checkout root: %s
721
 
   checkout of branch: %s
722
760
    shared repository: %s
 
761
    repository branch: branch
723
762
 
724
763
Format:
725
764
       control: Meta directory format 1
726
 
  working tree: Working tree format 4
727
 
        branch: %s
 
765
  working tree: Working tree format 3
 
766
        branch: Branch format 5
728
767
    repository: %s
729
768
 
730
769
Working tree is out of date: missing 1 revision.
746
785
   first revision: %s
747
786
  latest revision: %s
748
787
 
749
 
Repository:
 
788
Revision store:
750
789
         2 revisions
751
790
         %d KiB
752
791
""" % (tree2.bzrdir.root_transport.base,
753
 
       tree2.branch.bzrdir.root_transport.base,
754
792
       repo.bzrdir.root_transport.base,
755
 
       format.get_branch_format().get_format_description(),
756
 
       format.repository_format.get_format_description(),
 
793
       repo._format.get_format_description(),
757
794
       datestring_first, datestring_last,
758
795
       # poking at _revision_store isn't all that clean, but neither is
759
796
       # having the ui test dependent on the exact overhead of a given store.
762
799
        self.assertEqual('', err)
763
800
 
764
801
        # Show info about shared branch
765
 
        out, err = self.run_bzr('info repo/branch --verbose')
 
802
        out, err = self.runbzr('info repo/branch --verbose')
766
803
        self.assertEqualDiff(
767
 
"""Repository branch (format: dirstate or knit)
768
 
Location:
 
804
"""Location:
769
805
  shared repository: %s
770
806
  repository branch: branch
771
807
 
772
808
Format:
773
809
       control: Meta directory format 1
774
 
        branch: %s
 
810
        branch: Branch format 5
775
811
    repository: %s
776
812
 
777
813
Branch history:
781
817
   first revision: %s
782
818
  latest revision: %s
783
819
 
784
 
Repository:
 
820
Revision store:
785
821
         2 revisions
786
822
         %d KiB
787
823
""" % (repo.bzrdir.root_transport.base,
788
 
       format.get_branch_format().get_format_description(),
789
 
       format.repository_format.get_format_description(),
 
824
       repo._format.get_format_description(),
790
825
       datestring_first, datestring_last,
791
826
       # poking at _revision_store isn't all that clean, but neither is
792
827
       # having the ui test dependent on the exact overhead of a given store.
795
830
        self.assertEqual('', err)
796
831
 
797
832
        # Show info about repository with revisions
798
 
        out, err = self.run_bzr('info -v repo')
 
833
        out, err = self.runbzr('info repo')
799
834
        self.assertEqualDiff(
800
 
"""Shared repository (format: dirstate or dirstate-tags or knit)
801
 
Location:
 
835
"""Location:
802
836
  shared repository: %s
803
837
 
804
838
Format:
805
839
       control: Meta directory format 1
806
840
    repository: %s
807
841
 
808
 
Repository:
 
842
Revision store:
809
843
         2 revisions
810
844
         %d KiB
811
845
""" % (repo.bzrdir.root_transport.base,
812
 
       format.repository_format.get_format_description(),
 
846
       repo._format.get_format_description(),
813
847
       # poking at _revision_store isn't all that clean, but neither is
814
848
       # having the ui test dependent on the exact overhead of a given store.
815
849
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
816
850
       ), out)
817
851
        self.assertEqual('', err)
818
852
 
 
853
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
 
854
 
819
855
    def test_info_shared_repository_with_trees(self):
820
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
856
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
857
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
821
858
        transport = self.get_transport()
822
859
 
823
860
        # Create shared repository with working trees
824
 
        repo = self.make_repository('repo', shared=True, format=format)
 
861
        repo = self.make_repository('repo', shared=True)
825
862
        repo.set_make_working_trees(True)
826
 
        out, err = self.run_bzr('info -v repo')
 
863
        out, err = self.runbzr('info repo')
827
864
        self.assertEqualDiff(
828
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
829
 
Location:
 
865
"""Location:
830
866
  shared repository: %s
831
867
 
832
868
Format:
835
871
 
836
872
Create working tree for new branches inside the repository.
837
873
 
838
 
Repository:
 
874
Revision store:
839
875
         0 revisions
840
876
         0 KiB
841
877
""" % (repo.bzrdir.root_transport.base,
842
 
       format.repository_format.get_format_description(),
 
878
       repo._format.get_format_description(),
843
879
       ), out)
844
880
        self.assertEqual('', err)
845
881
 
846
882
        # Create two branches
847
883
        repo.bzrdir.root_transport.mkdir('branch1')
848
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
849
 
            format=format)
 
884
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
850
885
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
851
886
 
852
887
        # Empty first branch
853
 
        out, err = self.run_bzr('info repo/branch1 --verbose')
 
888
        out, err = self.runbzr('info repo/branch1 --verbose')
854
889
        self.assertEqualDiff(
855
 
"""Repository tree (format: knit)
856
 
Location:
857
 
  shared repository: %s
858
 
  repository branch: branch1
 
890
"""Location:
 
891
    shared repository: %s
 
892
  repository checkout: branch1
859
893
 
860
894
Format:
861
895
       control: Meta directory format 1
862
896
  working tree: Working tree format 3
863
 
        branch: %s
 
897
        branch: Branch format 5
864
898
    repository: %s
865
899
 
866
900
In the working tree:
877
911
         0 revisions
878
912
         0 committers
879
913
 
880
 
Repository:
 
914
Revision store:
881
915
         0 revisions
882
916
         0 KiB
883
917
""" % (repo.bzrdir.root_transport.base,
884
 
       format.get_branch_format().get_format_description(),
885
 
       format.repository_format.get_format_description(),
 
918
       repo._format.get_format_description(),
886
919
       ), out)
887
920
        self.assertEqual('', err)
888
921
 
893
926
        tree1.commit('commit one')
894
927
        rev = repo.get_revision(branch1.revision_history()[0])
895
928
        datestring_first = format_date(rev.timestamp, rev.timezone)
896
 
        out, err = self.run_bzr('info -v repo/branch1')
 
929
        out, err = self.runbzr('info repo/branch1')
897
930
        self.assertEqualDiff(
898
 
"""Repository tree (format: knit)
899
 
Location:
900
 
  shared repository: %s
901
 
  repository branch: branch1
 
931
"""Location:
 
932
    shared repository: %s
 
933
  repository checkout: branch1
902
934
 
903
935
Format:
904
936
       control: Meta directory format 1
905
937
  working tree: Working tree format 3
906
 
        branch: %s
 
938
        branch: Branch format 5
907
939
    repository: %s
908
940
 
909
941
In the working tree:
918
950
 
919
951
Branch history:
920
952
         1 revision
921
 
         1 committer
922
953
         0 days old
923
954
   first revision: %s
924
955
  latest revision: %s
925
956
 
926
 
Repository:
 
957
Revision store:
927
958
         1 revision
928
959
         %d KiB
929
960
""" % (repo.bzrdir.root_transport.base,
930
 
       format.get_branch_format().get_format_description(),
931
 
       format.repository_format.get_format_description(),
 
961
       repo._format.get_format_description(),
932
962
       datestring_first, datestring_first,
933
963
       # poking at _revision_store isn't all that clean, but neither is
934
964
       # having the ui test dependent on the exact overhead of a given store.
937
967
        self.assertEqual('', err)
938
968
 
939
969
        # Out of date second branch
940
 
        out, err = self.run_bzr('info repo/branch2 --verbose')
 
970
        out, err = self.runbzr('info repo/branch2 --verbose')
941
971
        self.assertEqualDiff(
942
 
"""Repository tree (format: knit)
943
 
Location:
944
 
  shared repository: %s
945
 
  repository branch: branch2
 
972
"""Location:
 
973
    shared repository: %s
 
974
  repository checkout: branch2
946
975
 
947
976
Related branches:
948
977
  parent branch: %s
950
979
Format:
951
980
       control: Meta directory format 1
952
981
  working tree: Working tree format 3
953
 
        branch: %s
 
982
        branch: Branch format 5
954
983
    repository: %s
955
984
 
956
985
In the working tree:
967
996
         0 revisions
968
997
         0 committers
969
998
 
970
 
Repository:
 
999
Revision store:
971
1000
         1 revision
972
1001
         %d KiB
973
1002
""" % (repo.bzrdir.root_transport.base,
974
1003
       branch1.bzrdir.root_transport.base,
975
 
       format.get_branch_format().get_format_description(),
976
 
       format.repository_format.get_format_description(),
 
1004
       repo._format.get_format_description(),
977
1005
       # poking at _revision_store isn't all that clean, but neither is
978
1006
       # having the ui test dependent on the exact overhead of a given store.
979
1007
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
983
1011
        # Update second branch
984
1012
        tree2 = branch2.bzrdir.open_workingtree()
985
1013
        tree2.pull(branch1)
986
 
        out, err = self.run_bzr('info -v repo/branch2')
 
1014
        out, err = self.runbzr('info repo/branch2')
987
1015
        self.assertEqualDiff(
988
 
"""Repository tree (format: knit)
989
 
Location:
990
 
  shared repository: %s
991
 
  repository branch: branch2
 
1016
"""Location:
 
1017
    shared repository: %s
 
1018
  repository checkout: branch2
992
1019
 
993
1020
Related branches:
994
1021
  parent branch: %s
996
1023
Format:
997
1024
       control: Meta directory format 1
998
1025
  working tree: Working tree format 3
999
 
        branch: %s
 
1026
        branch: Branch format 5
1000
1027
    repository: %s
1001
1028
 
1002
1029
In the working tree:
1011
1038
 
1012
1039
Branch history:
1013
1040
         1 revision
1014
 
         1 committer
1015
1041
         0 days old
1016
1042
   first revision: %s
1017
1043
  latest revision: %s
1018
1044
 
1019
 
Repository:
 
1045
Revision store:
1020
1046
         1 revision
1021
1047
         %d KiB
1022
1048
""" % (repo.bzrdir.root_transport.base,
1023
1049
       branch1.bzrdir.root_transport.base,
1024
 
       format.get_branch_format().get_format_description(),
1025
 
       format.repository_format.get_format_description(),
 
1050
       repo._format.get_format_description(),
1026
1051
       datestring_first, datestring_first,
1027
1052
       # poking at _revision_store isn't all that clean, but neither is
1028
1053
       # having the ui test dependent on the exact overhead of a given store.
1031
1056
        self.assertEqual('', err)
1032
1057
 
1033
1058
        # Show info about repository with revisions
1034
 
        out, err = self.run_bzr('info -v repo')
 
1059
        out, err = self.runbzr('info repo')
1035
1060
        self.assertEqualDiff(
1036
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1037
 
Location:
 
1061
"""Location:
1038
1062
  shared repository: %s
1039
1063
 
1040
1064
Format:
1043
1067
 
1044
1068
Create working tree for new branches inside the repository.
1045
1069
 
1046
 
Repository:
 
1070
Revision store:
1047
1071
         1 revision
1048
1072
         %d KiB
1049
1073
""" % (repo.bzrdir.root_transport.base,
1050
 
       format.repository_format.get_format_description(),
 
1074
       repo._format.get_format_description(),
1051
1075
       # poking at _revision_store isn't all that clean, but neither is
1052
1076
       # having the ui test dependent on the exact overhead of a given store.
1053
1077
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
1054
1078
       ),
1055
1079
       out)
1056
1080
        self.assertEqual('', err)
 
1081
 
 
1082
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1057
1083
    
1058
1084
    def test_info_shared_repository_with_tree_in_root(self):
1059
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
1085
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
1086
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
1060
1087
        transport = self.get_transport()
1061
1088
 
1062
1089
        # Create shared repository with working trees
1063
 
        repo = self.make_repository('repo', shared=True, format=format)
 
1090
        repo = self.make_repository('repo', shared=True)
1064
1091
        repo.set_make_working_trees(True)
1065
 
        out, err = self.run_bzr('info -v repo')
 
1092
        out, err = self.runbzr('info repo')
1066
1093
        self.assertEqualDiff(
1067
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1068
 
Location:
 
1094
"""Location:
1069
1095
  shared repository: %s
1070
1096
 
1071
1097
Format:
1074
1100
 
1075
1101
Create working tree for new branches inside the repository.
1076
1102
 
1077
 
Repository:
 
1103
Revision store:
1078
1104
         0 revisions
1079
1105
         0 KiB
1080
1106
""" % (repo.bzrdir.root_transport.base,
1081
 
       format.repository_format.get_format_description(),
 
1107
       repo._format.get_format_description(),
1082
1108
       ), out)
1083
1109
        self.assertEqual('', err)
1084
1110
 
1086
1112
        control = repo.bzrdir
1087
1113
        branch = control.create_branch()
1088
1114
        control.create_workingtree()
1089
 
        out, err = self.run_bzr('info -v repo')
 
1115
        out, err = self.runbzr('info repo')
1090
1116
        self.assertEqualDiff(
1091
 
"""Repository tree (format: knit)
1092
 
Location:
1093
 
  shared repository: %s
1094
 
  repository branch: .
 
1117
"""Location:
 
1118
    shared repository: %s
 
1119
  repository checkout: .
1095
1120
 
1096
1121
Format:
1097
1122
       control: Meta directory format 1
1098
1123
  working tree: Working tree format 3
1099
 
        branch: %s
 
1124
        branch: Branch format 5
1100
1125
    repository: %s
1101
1126
 
1102
1127
In the working tree:
1111
1136
 
1112
1137
Branch history:
1113
1138
         0 revisions
1114
 
         0 committers
1115
1139
 
1116
 
Repository:
 
1140
Revision store:
1117
1141
         0 revisions
1118
1142
         0 KiB
1119
1143
""" % (repo.bzrdir.root_transport.base,
1120
 
       format.get_branch_format().get_format_description(),
1121
 
       format.repository_format.get_format_description(),
 
1144
       repo._format.get_format_description(),
1122
1145
       ), out)
1123
1146
        self.assertEqual('', err)
1124
1147
 
1125
 
    def assertCheckoutStatusOutput(self, 
1126
 
        command_string, lco_tree, shared_repo=None,
1127
 
        repo_branch=None,
1128
 
        tree_locked=False,
1129
 
        branch_locked=False, repo_locked=False,
1130
 
        verbose=False,
1131
 
        light_checkout=True,
1132
 
        checkout_root=None):
1133
 
        """Check the output of info in a checkout.
1134
 
 
1135
 
        This is not quite a mirror of the info code: rather than using the
1136
 
        tree being examined to predict output, it uses a bunch of flags which
1137
 
        allow us, the test writers, to document what *should* be present in
1138
 
        the output. Removing this separation would remove the value of the
1139
 
        tests.
1140
 
        
1141
 
        :param path: the path to the light checkout.
1142
 
        :param lco_tree: the tree object for the light checkout.
1143
 
        :param shared_repo: A shared repository is in use, expect that in
1144
 
            the output.
1145
 
        :param repo_branch: A branch in a shared repository for non light
1146
 
            checkouts.
1147
 
        :param tree_locked: If true, expect the tree to be locked.
1148
 
        :param branch_locked: If true, expect the branch to be locked.
1149
 
        :param repo_locked: If true, expect the repository to be locked.
1150
 
        :param verbose: If true, expect verbose output
1151
 
        """
1152
 
        if tree_locked and sys.platform == 'win32':
1153
 
            # We expect this to fail because of locking errors. (A write-locked
1154
 
            # file cannot be read-locked in the same process).
1155
 
            # This should be removed when the locking errors are fixed.
1156
 
            args = command_string.split(' ')
1157
 
            self.run_bzr_error([], 'info', *args)
1158
 
            return
1159
 
        out, err = self.run_bzr('info %s' % command_string)
1160
 
        description = {
1161
 
            (True, True): 'Lightweight checkout',
1162
 
            (True, False): 'Repository checkout',
1163
 
            (False, True): 'Lightweight checkout',
1164
 
            (False, False): 'Checkout',
1165
 
            }[(shared_repo is not None, light_checkout)]
1166
 
        format = {True: 'dirstate or dirstate-tags',
1167
 
                  False: 'dirstate'}[light_checkout]
1168
 
        if repo_locked or branch_locked or tree_locked:
1169
 
            def locked_message(a_bool):
1170
 
                if a_bool:
1171
 
                    return 'locked'
1172
 
                else:
1173
 
                    return 'unlocked'
1174
 
            expected_lock_output = (
1175
 
                "\n"
1176
 
                "Lock status:\n"
1177
 
                "  working tree: %s\n"
1178
 
                "        branch: %s\n"
1179
 
                "    repository: %s\n" % (
1180
 
                    locked_message(tree_locked),
1181
 
                    locked_message(branch_locked),
1182
 
                    locked_message(repo_locked)))
1183
 
        else:
1184
 
            expected_lock_output = ''
1185
 
        tree_data = ''
1186
 
        extra_space = ''
1187
 
        if light_checkout:
1188
 
            tree_data = ("  light checkout root: %s\n" %
1189
 
                lco_tree.bzrdir.root_transport.base)
1190
 
            extra_space = ' '
1191
 
        if lco_tree.branch.get_bound_location() is not None:
1192
 
            tree_data += ("%s       checkout root: %s\n" % (extra_space,
1193
 
                lco_tree.branch.bzrdir.root_transport.base))
1194
 
        if shared_repo is not None:
1195
 
            branch_data = (
1196
 
                "   checkout of branch: %s\n"
1197
 
                "    shared repository: %s\n" %
1198
 
                (repo_branch.bzrdir.root_transport.base,
1199
 
                 shared_repo.bzrdir.root_transport.base))
1200
 
        elif repo_branch is not None:
1201
 
            branch_data = (
1202
 
                "%s  checkout of branch: %s\n" %
1203
 
                (extra_space,
1204
 
                 repo_branch.bzrdir.root_transport.base))
1205
 
        else:
1206
 
            branch_data = ("   checkout of branch: %s\n" %
1207
 
                lco_tree.branch.bzrdir.root_transport.base)
1208
 
        
1209
 
        if verbose:
1210
 
            verbose_info = '         0 committers\n'
1211
 
        else:
1212
 
            verbose_info = ''
1213
 
            
1214
 
        self.assertEqualDiff(
1215
 
"""%s (format: %s)
1216
 
Location:
1217
 
%s%s
1218
 
Format:
1219
 
       control: Meta directory format 1
1220
 
  working tree: %s
1221
 
        branch: %s
1222
 
    repository: %s
1223
 
%s
1224
 
In the working tree:
1225
 
         0 unchanged
1226
 
         0 modified
1227
 
         0 added
1228
 
         0 removed
1229
 
         0 renamed
1230
 
         0 unknown
1231
 
         0 ignored
1232
 
         0 versioned subdirectories
1233
 
 
1234
 
Branch history:
1235
 
         0 revisions
1236
 
%s
1237
 
Repository:
1238
 
         0 revisions
1239
 
         0 KiB
1240
 
""" %  (description,
1241
 
        format,
1242
 
        tree_data,
1243
 
        branch_data,
1244
 
        lco_tree._format.get_format_description(),
1245
 
        lco_tree.branch._format.get_format_description(),
1246
 
        lco_tree.branch.repository._format.get_format_description(),
1247
 
        expected_lock_output,
1248
 
        verbose_info,
1249
 
        ), out)
1250
 
        self.assertEqual('', err)
 
1148
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1251
1149
 
1252
1150
    def test_info_locking(self):
1253
1151
        transport = self.get_transport()
1262
1160
        transport.mkdir('tree')
1263
1161
        transport.mkdir('tree/checkout')
1264
1162
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1265
 
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
 
1163
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1266
1164
        co_branch.bind(repo_branch)
1267
1165
        # Do a light checkout of the heavy one
1268
1166
        transport.mkdir('tree/lightcheckout')
1275
1173
        # W B R
1276
1174
 
1277
1175
        # U U U
1278
 
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1279
 
                                        repo_branch=repo_branch,
1280
 
                                        verbose=True, light_checkout=True)
 
1176
        out, err = self.runbzr('info tree/lightcheckout')
 
1177
        self.assertEqualDiff(
 
1178
"""Location:
 
1179
  light checkout root: %s
 
1180
   checkout of branch: %s
 
1181
 
 
1182
Format:
 
1183
       control: Meta directory format 1
 
1184
  working tree: Working tree format 3
 
1185
        branch: Branch format 5
 
1186
    repository: %s
 
1187
 
 
1188
In the working tree:
 
1189
         0 unchanged
 
1190
         0 modified
 
1191
         0 added
 
1192
         0 removed
 
1193
         0 renamed
 
1194
         0 unknown
 
1195
         0 ignored
 
1196
         0 versioned subdirectories
 
1197
 
 
1198
Branch history:
 
1199
         0 revisions
 
1200
 
 
1201
Revision store:
 
1202
         0 revisions
 
1203
         0 KiB
 
1204
""" % (lco_tree.bzrdir.root_transport.base,
 
1205
       lco_tree.branch.bzrdir.root_transport.base,
 
1206
       lco_tree.branch.repository._format.get_format_description(),
 
1207
       ), out)
 
1208
        self.assertEqual('', err)
1281
1209
        # U U L
1282
1210
        lco_tree.branch.repository.lock_write()
1283
 
        try:
1284
 
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1285
 
            lco_tree, repo_branch=repo_branch,
1286
 
            repo_locked=True, verbose=True, light_checkout=True)
1287
 
        finally:
1288
 
            lco_tree.branch.repository.unlock()
 
1211
        out, err = self.runbzr('info tree/lightcheckout')
 
1212
        self.assertEqualDiff(
 
1213
"""Location:
 
1214
  light checkout root: %s
 
1215
   checkout of branch: %s
 
1216
 
 
1217
Format:
 
1218
       control: Meta directory format 1
 
1219
  working tree: Working tree format 3
 
1220
        branch: Branch format 5
 
1221
    repository: %s
 
1222
 
 
1223
Lock status:
 
1224
  working tree: unlocked
 
1225
        branch: unlocked
 
1226
    repository: locked
 
1227
 
 
1228
In the working tree:
 
1229
         0 unchanged
 
1230
         0 modified
 
1231
         0 added
 
1232
         0 removed
 
1233
         0 renamed
 
1234
         0 unknown
 
1235
         0 ignored
 
1236
         0 versioned subdirectories
 
1237
 
 
1238
Branch history:
 
1239
         0 revisions
 
1240
 
 
1241
Revision store:
 
1242
         0 revisions
 
1243
         0 KiB
 
1244
""" % (lco_tree.bzrdir.root_transport.base,
 
1245
       lco_tree.branch.bzrdir.root_transport.base,
 
1246
       lco_tree.branch.repository._format.get_format_description(),
 
1247
       ), out)
 
1248
        self.assertEqual('', err)
 
1249
        lco_tree.branch.repository.unlock()
1289
1250
        # U L L
1290
1251
        lco_tree.branch.lock_write()
1291
 
        try:
1292
 
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1293
 
            lco_tree,
1294
 
            branch_locked=True,
1295
 
            repo_locked=True,
1296
 
            repo_branch=repo_branch,
1297
 
            verbose=True)
1298
 
        finally:
1299
 
            lco_tree.branch.unlock()
 
1252
        out, err = self.runbzr('info tree/lightcheckout')
 
1253
        self.assertEqualDiff(
 
1254
"""Location:
 
1255
  light checkout root: %s
 
1256
   checkout of branch: %s
 
1257
 
 
1258
Format:
 
1259
       control: Meta directory format 1
 
1260
  working tree: Working tree format 3
 
1261
        branch: Branch format 5
 
1262
    repository: %s
 
1263
 
 
1264
Lock status:
 
1265
  working tree: unlocked
 
1266
        branch: locked
 
1267
    repository: locked
 
1268
 
 
1269
In the working tree:
 
1270
         0 unchanged
 
1271
         0 modified
 
1272
         0 added
 
1273
         0 removed
 
1274
         0 renamed
 
1275
         0 unknown
 
1276
         0 ignored
 
1277
         0 versioned subdirectories
 
1278
 
 
1279
Branch history:
 
1280
         0 revisions
 
1281
 
 
1282
Revision store:
 
1283
         0 revisions
 
1284
         0 KiB
 
1285
""" % (lco_tree.bzrdir.root_transport.base,
 
1286
       lco_tree.branch.bzrdir.root_transport.base,
 
1287
       lco_tree.branch.repository._format.get_format_description(),
 
1288
       ), out)
 
1289
        self.assertEqual('', err)
 
1290
        lco_tree.branch.unlock()
1300
1291
        # L L L
1301
1292
        lco_tree.lock_write()
1302
 
        try:
1303
 
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1304
 
            lco_tree, repo_branch=repo_branch,
1305
 
            tree_locked=True,
1306
 
            branch_locked=True,
1307
 
            repo_locked=True,
1308
 
            verbose=True)
1309
 
        finally:
1310
 
            lco_tree.unlock()
 
1293
        out, err = self.runbzr('info tree/lightcheckout')
 
1294
        self.assertEqualDiff(
 
1295
"""Location:
 
1296
  light checkout root: %s
 
1297
   checkout of branch: %s
 
1298
 
 
1299
Format:
 
1300
       control: Meta directory format 1
 
1301
  working tree: Working tree format 3
 
1302
        branch: Branch format 5
 
1303
    repository: %s
 
1304
 
 
1305
Lock status:
 
1306
  working tree: locked
 
1307
        branch: locked
 
1308
    repository: locked
 
1309
 
 
1310
In the working tree:
 
1311
         0 unchanged
 
1312
         0 modified
 
1313
         0 added
 
1314
         0 removed
 
1315
         0 renamed
 
1316
         0 unknown
 
1317
         0 ignored
 
1318
         0 versioned subdirectories
 
1319
 
 
1320
Branch history:
 
1321
         0 revisions
 
1322
 
 
1323
Revision store:
 
1324
         0 revisions
 
1325
         0 KiB
 
1326
""" % (lco_tree.bzrdir.root_transport.base,
 
1327
       lco_tree.branch.bzrdir.root_transport.base,
 
1328
       lco_tree.branch.repository._format.get_format_description(),
 
1329
       ), out)
 
1330
        self.assertEqual('', err)
 
1331
        lco_tree.unlock()
1311
1332
        # L L U
1312
1333
        lco_tree.lock_write()
1313
1334
        lco_tree.branch.repository.unlock()
1314
 
        try:
1315
 
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1316
 
            lco_tree, repo_branch=repo_branch,
1317
 
            tree_locked=True,
1318
 
            branch_locked=True,
1319
 
            verbose=True)
1320
 
        finally:
1321
 
            lco_tree.branch.repository.lock_write()
1322
 
            lco_tree.unlock()
 
1335
        out, err = self.runbzr('info tree/lightcheckout')
 
1336
        self.assertEqualDiff(
 
1337
"""Location:
 
1338
  light checkout root: %s
 
1339
   checkout of branch: %s
 
1340
 
 
1341
Format:
 
1342
       control: Meta directory format 1
 
1343
  working tree: Working tree format 3
 
1344
        branch: Branch format 5
 
1345
    repository: %s
 
1346
 
 
1347
Lock status:
 
1348
  working tree: locked
 
1349
        branch: locked
 
1350
    repository: unlocked
 
1351
 
 
1352
In the working tree:
 
1353
         0 unchanged
 
1354
         0 modified
 
1355
         0 added
 
1356
         0 removed
 
1357
         0 renamed
 
1358
         0 unknown
 
1359
         0 ignored
 
1360
         0 versioned subdirectories
 
1361
 
 
1362
Branch history:
 
1363
         0 revisions
 
1364
 
 
1365
Revision store:
 
1366
         0 revisions
 
1367
         0 KiB
 
1368
""" % (lco_tree.bzrdir.root_transport.base,
 
1369
       lco_tree.branch.bzrdir.root_transport.base,
 
1370
       lco_tree.branch.repository._format.get_format_description(),
 
1371
       ), out)
 
1372
        self.assertEqual('', err)
 
1373
        lco_tree.branch.repository.lock_write()
 
1374
        lco_tree.unlock()
1323
1375
        # L U U
1324
1376
        lco_tree.lock_write()
1325
1377
        lco_tree.branch.unlock()
1326
 
        try:
1327
 
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1328
 
            lco_tree, repo_branch=repo_branch,
1329
 
            tree_locked=True,
1330
 
            verbose=True)
1331
 
        finally:
1332
 
            lco_tree.branch.lock_write()
1333
 
            lco_tree.unlock()
 
1378
        out, err = self.runbzr('info tree/lightcheckout')
 
1379
        self.assertEqualDiff(
 
1380
"""Location:
 
1381
  light checkout root: %s
 
1382
   checkout of branch: %s
 
1383
 
 
1384
Format:
 
1385
       control: Meta directory format 1
 
1386
  working tree: Working tree format 3
 
1387
        branch: Branch format 5
 
1388
    repository: %s
 
1389
 
 
1390
Lock status:
 
1391
  working tree: locked
 
1392
        branch: unlocked
 
1393
    repository: unlocked
 
1394
 
 
1395
In the working tree:
 
1396
         0 unchanged
 
1397
         0 modified
 
1398
         0 added
 
1399
         0 removed
 
1400
         0 renamed
 
1401
         0 unknown
 
1402
         0 ignored
 
1403
         0 versioned subdirectories
 
1404
 
 
1405
Branch history:
 
1406
         0 revisions
 
1407
 
 
1408
Revision store:
 
1409
         0 revisions
 
1410
         0 KiB
 
1411
""" % (lco_tree.bzrdir.root_transport.base,
 
1412
       lco_tree.branch.bzrdir.root_transport.base,
 
1413
       lco_tree.branch.repository._format.get_format_description(),
 
1414
       ), out)
 
1415
        self.assertEqual('', err)
 
1416
        lco_tree.branch.lock_write()
 
1417
        lco_tree.unlock()
1334
1418
        # L U L
1335
1419
        lco_tree.lock_write()
1336
1420
        lco_tree.branch.unlock()
1337
1421
        lco_tree.branch.repository.lock_write()
1338
 
        try:
1339
 
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1340
 
            lco_tree, repo_branch=repo_branch,
1341
 
            tree_locked=True,
1342
 
            repo_locked=True,
1343
 
            verbose=True)
1344
 
        finally:
1345
 
            lco_tree.branch.repository.unlock()
1346
 
            lco_tree.branch.lock_write()
1347
 
            lco_tree.unlock()
 
1422
        out, err = self.runbzr('info tree/lightcheckout')
 
1423
        self.assertEqualDiff(
 
1424
"""Location:
 
1425
  light checkout root: %s
 
1426
   checkout of branch: %s
 
1427
 
 
1428
Format:
 
1429
       control: Meta directory format 1
 
1430
  working tree: Working tree format 3
 
1431
        branch: Branch format 5
 
1432
    repository: %s
 
1433
 
 
1434
Lock status:
 
1435
  working tree: locked
 
1436
        branch: unlocked
 
1437
    repository: locked
 
1438
 
 
1439
In the working tree:
 
1440
         0 unchanged
 
1441
         0 modified
 
1442
         0 added
 
1443
         0 removed
 
1444
         0 renamed
 
1445
         0 unknown
 
1446
         0 ignored
 
1447
         0 versioned subdirectories
 
1448
 
 
1449
Branch history:
 
1450
         0 revisions
 
1451
 
 
1452
Revision store:
 
1453
         0 revisions
 
1454
         0 KiB
 
1455
""" % (lco_tree.bzrdir.root_transport.base,
 
1456
       lco_tree.branch.bzrdir.root_transport.base,
 
1457
       lco_tree.branch.repository._format.get_format_description(),
 
1458
       ), out)
 
1459
        self.assertEqual('', err)
 
1460
        lco_tree.branch.repository.unlock()
 
1461
        lco_tree.branch.lock_write()
 
1462
        lco_tree.unlock()
1348
1463
        # U L U
1349
1464
        lco_tree.branch.lock_write()
1350
1465
        lco_tree.branch.repository.unlock()
1351
 
        try:
1352
 
            self.assertCheckoutStatusOutput('-v tree/lightcheckout',
1353
 
            lco_tree, repo_branch=repo_branch,
1354
 
            branch_locked=True,
1355
 
            verbose=True)
1356
 
        finally:
1357
 
            lco_tree.branch.repository.lock_write()
1358
 
            lco_tree.branch.unlock()
1359
 
 
1360
 
        if sys.platform == 'win32':
1361
 
            self.knownFailure('Win32 cannot run "bzr info"'
1362
 
                              ' when the tree is locked.')
 
1466
        out, err = self.runbzr('info tree/lightcheckout')
 
1467
        self.assertEqualDiff(
 
1468
"""Location:
 
1469
  light checkout root: %s
 
1470
   checkout of branch: %s
 
1471
 
 
1472
Format:
 
1473
       control: Meta directory format 1
 
1474
  working tree: Working tree format 3
 
1475
        branch: Branch format 5
 
1476
    repository: %s
 
1477
 
 
1478
Lock status:
 
1479
  working tree: unlocked
 
1480
        branch: locked
 
1481
    repository: unlocked
 
1482
 
 
1483
In the working tree:
 
1484
         0 unchanged
 
1485
         0 modified
 
1486
         0 added
 
1487
         0 removed
 
1488
         0 renamed
 
1489
         0 unknown
 
1490
         0 ignored
 
1491
         0 versioned subdirectories
 
1492
 
 
1493
Branch history:
 
1494
         0 revisions
 
1495
 
 
1496
Revision store:
 
1497
         0 revisions
 
1498
         0 KiB
 
1499
""" % (lco_tree.bzrdir.root_transport.base,
 
1500
       lco_tree.branch.bzrdir.root_transport.base,
 
1501
       lco_tree.branch.repository._format.get_format_description(),
 
1502
       ), out)
 
1503
        self.assertEqual('', err)
 
1504
        lco_tree.branch.repository.lock_write()
 
1505
        lco_tree.branch.unlock()
1363
1506
 
1364
1507
    def test_info_locking_oslocks(self):
1365
 
        if sys.platform == "win32":
1366
 
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1367
 
 
1368
1508
        tree = self.make_branch_and_tree('branch',
1369
1509
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1370
1510
 
1375
1515
        # W B R
1376
1516
 
1377
1517
        # U U U
1378
 
        out, err = self.run_bzr('info -v branch')
 
1518
        out, err = self.runbzr('info branch')
1379
1519
        self.assertEqualDiff(
1380
 
"""Standalone tree (format: weave)
1381
 
Location:
 
1520
"""Location:
1382
1521
  branch root: %s
1383
1522
 
1384
1523
Format:
1399
1538
 
1400
1539
Branch history:
1401
1540
         0 revisions
1402
 
         0 committers
1403
1541
 
1404
 
Repository:
 
1542
Revision store:
1405
1543
         0 revisions
1406
1544
         0 KiB
1407
1545
""" % (tree.bzrdir.root_transport.base,
1410
1548
        self.assertEqual('', err)
1411
1549
        # L L L
1412
1550
        tree.lock_write()
1413
 
        out, err = self.run_bzr('info -v branch')
 
1551
        out, err = self.runbzr('info branch')
1414
1552
        self.assertEqualDiff(
1415
 
"""Standalone tree (format: weave)
1416
 
Location:
 
1553
"""Location:
1417
1554
  branch root: %s
1418
1555
 
1419
1556
Format:
1434
1571
 
1435
1572
Branch history:
1436
1573
         0 revisions
1437
 
         0 committers
1438
1574
 
1439
 
Repository:
 
1575
Revision store:
1440
1576
         0 revisions
1441
1577
         0 KiB
1442
1578
""" % (tree.bzrdir.root_transport.base,