~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge bzr.dev

Show diffs side-by-side

added added

removed removed

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