/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: Robert Collins
  • Date: 2007-06-28 05:19:04 UTC
  • mto: (2553.2.13 integration)
  • mto: This revision was merged to the branch mainline in revision 2568.
  • Revision ID: robertc@robertcollins.net-20070628051904-mjbhgq3n8dw3m8jg
And overhaul BranchTestProviderAdapter too.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 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
20
import sys
21
21
 
 
22
import bzrlib
22
23
from bzrlib import (
23
 
    branch,
24
24
    bzrdir,
25
 
    errors,
26
 
    info,
27
 
    osutils,
28
 
    tests,
29
 
    upgrade,
30
 
    urlutils,
 
25
    repository,
31
26
    )
32
 
from bzrlib.transport import memory
33
 
 
34
 
 
35
 
class TestInfo(tests.TestCaseWithTransport):
36
 
 
37
 
    def setUp(self):
38
 
        super(TestInfo, self).setUp()
39
 
        self._repo_strings = "2a"
 
27
from bzrlib.osutils import format_date
 
28
from bzrlib.tests import TestSkipped
 
29
from bzrlib.tests.blackbox import ExternalBase
 
30
 
 
31
 
 
32
class TestInfo(ExternalBase):
40
33
 
41
34
    def test_info_non_existing(self):
42
 
        self.vfs_transport_factory = memory.MemoryServer
43
 
        location = self.get_url()
44
 
        out, err = self.run_bzr('info '+location, retcode=3)
 
35
        if sys.platform == "win32":
 
36
            location = "C:/i/do/not/exist/"
 
37
        else:
 
38
            location = "/i/do/not/exist/"
 
39
        out, err = self.runbzr('info '+location, retcode=3)
45
40
        self.assertEqual(out, '')
46
 
        self.assertEqual(err, 'bzr: ERROR: Not a branch: "%s".\n' % location)
 
41
        self.assertEqual(err, 'bzr: ERROR: Not a branch: %s\n' % location)
47
42
 
48
43
    def test_info_standalone(self):
49
44
        transport = self.get_transport()
53
48
        self.build_tree(['standalone/a'])
54
49
        tree1.add('a')
55
50
        branch1 = tree1.branch
56
 
 
57
 
        out, err = self.run_bzr('info standalone')
58
 
        self.assertEqualDiff(
59
 
"""Standalone tree (format: weave)
60
 
Location:
61
 
  branch root: standalone
62
 
""", out)
63
 
        self.assertEqual('', err)
64
 
 
65
 
        # Standalone branch - verbose mode
66
 
        out, err = self.run_bzr('info standalone -v')
67
 
        self.assertEqualDiff(
68
 
"""Standalone tree (format: weave)
69
 
Location:
70
 
  branch root: standalone
71
 
 
72
 
Format:
73
 
       control: All-in-one format 6
74
 
  working tree: Working tree format 2
75
 
        branch: Branch format 4
76
 
    repository: Weave repository format 6
77
 
 
78
 
In the working tree:
79
 
         0 unchanged
80
 
         0 modified
81
 
         1 added
82
 
         0 removed
83
 
         0 renamed
84
 
         0 unknown
85
 
         0 ignored
86
 
         0 versioned subdirectories
87
 
 
88
 
Branch history:
89
 
         0 revisions
90
 
 
91
 
Repository:
92
 
         0 revisions
93
 
""", out)
94
 
        self.assertEqual('', err)
95
 
 
96
 
        # Standalone branch - really verbose mode
97
 
        out, err = self.run_bzr('info standalone -vv')
98
 
        self.assertEqualDiff(
99
 
"""Standalone tree (format: weave)
100
 
Location:
101
 
  branch root: standalone
 
51
        out, err = self.runbzr('info standalone -v')
 
52
        self.assertEqualDiff(
 
53
"""Standalone tree (format: weave)
 
54
Location:
 
55
  branch root: %s
102
56
 
103
57
Format:
104
58
       control: All-in-one format 6
122
76
 
123
77
Repository:
124
78
         0 revisions
125
 
""", out)
 
79
         0 KiB
 
80
""" % branch1.bzrdir.root_transport.base, out)
126
81
        self.assertEqual('', err)
127
82
        tree1.commit('commit one')
128
83
        rev = branch1.repository.get_revision(branch1.revision_history()[0])
129
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
 
84
        datestring_first = format_date(rev.timestamp, rev.timezone)
130
85
 
131
86
        # Branch standalone with push location
132
87
        branch2 = branch1.bzrdir.sprout('branch').open_branch()
133
88
        branch2.set_push_location(branch1.bzrdir.root_transport.base)
134
 
 
135
 
        out, err = self.run_bzr('info branch')
136
 
        self.assertEqualDiff(
137
 
"""Standalone tree (format: weave)
138
 
Location:
139
 
  branch root: branch
140
 
 
141
 
Related branches:
142
 
    push branch: standalone
143
 
  parent branch: standalone
144
 
""", out)
145
 
        self.assertEqual('', err)
146
 
 
147
 
        out, err = self.run_bzr('info branch --verbose')
148
 
        self.assertEqualDiff(
149
 
"""Standalone tree (format: weave)
150
 
Location:
151
 
  branch root: branch
152
 
 
153
 
Related branches:
154
 
    push branch: standalone
155
 
  parent branch: standalone
 
89
        out, err = self.runbzr('info branch --verbose')
 
90
        self.assertEqualDiff(
 
91
"""Standalone tree (format: weave)
 
92
Location:
 
93
  branch root: %s
 
94
 
 
95
Related branches:
 
96
      parent branch: %s
 
97
  publish to branch: %s
156
98
 
157
99
Format:
158
100
       control: All-in-one format 6
172
114
 
173
115
Branch history:
174
116
         1 revision
 
117
         1 committer
175
118
         0 days old
176
119
   first revision: %s
177
120
  latest revision: %s
178
121
 
179
122
Repository:
180
123
         1 revision
181
 
""" % (datestring_first, datestring_first,
 
124
         %d KiB
 
125
""" % (branch2.bzrdir.root_transport.base,
 
126
       branch1.bzrdir.root_transport.base,
 
127
       branch1.bzrdir.root_transport.base,
 
128
       datestring_first, datestring_first,
 
129
       # poking at _revision_store isn't all that clean, but neither is
 
130
       # having the ui test dependent on the exact overhead of a given store.
 
131
       branch2.repository._revision_store.total_size(
 
132
        branch2.repository.get_transaction())[1] / 1024,
182
133
       ), out)
183
134
        self.assertEqual('', err)
184
135
 
186
137
        # (creates backup as unknown)
187
138
        branch1.bzrdir.sprout('bound')
188
139
        knit1_format = bzrdir.format_registry.make_bzrdir('knit')
189
 
        upgrade.upgrade('bound', knit1_format)
190
 
        branch3 = bzrdir.BzrDir.open('bound').open_branch()
 
140
        bzrlib.upgrade.upgrade('bound', knit1_format)
 
141
        branch3 = bzrlib.bzrdir.BzrDir.open('bound').open_branch()
191
142
        branch3.bind(branch1)
192
143
        bound_tree = branch3.bzrdir.open_workingtree()
193
 
        out, err = self.run_bzr('info -v bound')
 
144
        out, err = self.runbzr('info -v bound')
194
145
        self.assertEqualDiff(
195
146
"""Checkout (format: knit)
196
147
Location:
197
 
       checkout root: bound
198
 
  checkout of branch: standalone
 
148
       checkout root: %s
 
149
  checkout of branch: %s
199
150
 
200
151
Related branches:
201
 
  parent branch: standalone
 
152
  parent branch: %s
202
153
 
203
154
Format:
204
155
       control: Meta directory format 1
212
163
         0 added
213
164
         0 removed
214
165
         0 renamed
215
 
         0 unknown
216
 
         1 ignored
 
166
         1 unknown
 
167
         0 ignored
217
168
         0 versioned subdirectories
218
169
 
219
170
Branch history:
220
171
         1 revision
 
172
         1 committer
221
173
         0 days old
222
174
   first revision: %s
223
175
  latest revision: %s
224
176
 
225
177
Repository:
226
178
         1 revision
227
 
""" % (bound_tree._format.get_format_description(),
 
179
         %d KiB
 
180
""" % (branch3.bzrdir.root_transport.base,
 
181
       branch1.bzrdir.root_transport.base,
 
182
       branch1.bzrdir.root_transport.base,
 
183
       bound_tree._format.get_format_description(),      
228
184
       branch3._format.get_format_description(),
229
185
       branch3.repository._format.get_format_description(),
230
186
       datestring_first, datestring_first,
 
187
       # poking at _revision_store isn't all that clean, but neither is
 
188
       # having the ui test dependent on the exact overhead of a given store.
 
189
       branch3.repository._revision_store.total_size(
 
190
        branch3.repository.get_transaction())[1] / 1024,
231
191
       ), out)
232
192
        self.assertEqual('', err)
233
193
 
234
194
        # Checkout standalone (same as above, but does not have parent set)
235
 
        branch4 = bzrdir.BzrDir.create_branch_convenience('checkout',
 
195
        branch4 = bzrlib.bzrdir.BzrDir.create_branch_convenience('checkout',
236
196
            format=knit1_format)
237
197
        branch4.bind(branch1)
238
198
        branch4.bzrdir.open_workingtree().update()
239
 
        out, err = self.run_bzr('info checkout --verbose')
 
199
        out, err = self.runbzr('info checkout --verbose')
240
200
        self.assertEqualDiff(
241
201
"""Checkout (format: knit)
242
202
Location:
243
 
       checkout root: checkout
244
 
  checkout of branch: standalone
 
203
       checkout root: %s
 
204
  checkout of branch: %s
245
205
 
246
206
Format:
247
207
       control: Meta directory format 1
261
221
 
262
222
Branch history:
263
223
         1 revision
 
224
         1 committer
264
225
         0 days old
265
226
   first revision: %s
266
227
  latest revision: %s
267
228
 
268
229
Repository:
269
230
         1 revision
270
 
""" % (branch4.repository._format.get_format_description(),
 
231
         %d KiB
 
232
""" % (branch4.bzrdir.root_transport.base,
 
233
       branch1.bzrdir.root_transport.base,
 
234
       branch4.repository._format.get_format_description(),
271
235
       datestring_first, datestring_first,
 
236
       # poking at _revision_store isn't all that clean, but neither is
 
237
       # having the ui test dependent on the exact overhead of a given store.
 
238
       branch4.repository._revision_store.total_size(
 
239
        branch4.repository.get_transaction())[1] / 1024,
272
240
       ), out)
273
241
        self.assertEqual('', err)
274
242
 
275
243
        # Lightweight checkout (same as above, different branch and repository)
276
244
        tree5 = branch1.create_checkout('lightcheckout', lightweight=True)
277
245
        branch5 = tree5.branch
278
 
        out, err = self.run_bzr('info -v lightcheckout')
 
246
        out, err = self.runbzr('info -v lightcheckout')
279
247
        self.assertEqualDiff(
280
 
"""Lightweight checkout (format: %s)
 
248
"""Lightweight checkout (format: dirstate or dirstate-tags)
281
249
Location:
282
 
  light checkout root: lightcheckout
283
 
   checkout of branch: standalone
 
250
  light checkout root: %s
 
251
   checkout of branch: %s
284
252
 
285
253
Format:
286
254
       control: Meta directory format 1
287
 
  working tree: Working tree format 6
 
255
  working tree: Working tree format 4
288
256
        branch: Branch format 4
289
257
    repository: Weave repository format 6
290
258
 
300
268
 
301
269
Branch history:
302
270
         1 revision
 
271
         1 committer
303
272
         0 days old
304
273
   first revision: %s
305
274
  latest revision: %s
306
275
 
307
276
Repository:
308
277
         1 revision
309
 
""" % (self._repo_strings, datestring_first, datestring_first,), out)
 
278
         0 KiB
 
279
""" % (tree5.bzrdir.root_transport.base,
 
280
       branch1.bzrdir.root_transport.base,
 
281
       datestring_first, datestring_first,
 
282
       ), out)
310
283
        self.assertEqual('', err)
311
284
 
312
285
        # Update initial standalone branch
314
287
        tree1.add('b')
315
288
        tree1.commit('commit two')
316
289
        rev = branch1.repository.get_revision(branch1.revision_history()[-1])
317
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
 
290
        datestring_last = format_date(rev.timestamp, rev.timezone)
318
291
 
319
292
        # Out of date branched standalone branch will not be detected
320
 
        out, err = self.run_bzr('info -v branch')
 
293
        out, err = self.runbzr('info -v branch')
321
294
        self.assertEqualDiff(
322
295
"""Standalone tree (format: weave)
323
296
Location:
324
 
  branch root: branch
 
297
  branch root: %s
325
298
 
326
299
Related branches:
327
 
    push branch: standalone
328
 
  parent branch: standalone
 
300
      parent branch: %s
 
301
  publish to branch: %s
329
302
 
330
303
Format:
331
304
       control: All-in-one format 6
345
318
 
346
319
Branch history:
347
320
         1 revision
 
321
         1 committer
348
322
         0 days old
349
323
   first revision: %s
350
324
  latest revision: %s
351
325
 
352
326
Repository:
353
327
         1 revision
354
 
""" % (datestring_first, datestring_first,
 
328
         0 KiB
 
329
""" % (branch2.bzrdir.root_transport.base,
 
330
       branch1.bzrdir.root_transport.base,
 
331
       branch1.bzrdir.root_transport.base,
 
332
       datestring_first, datestring_first,
355
333
       ), out)
356
334
        self.assertEqual('', err)
357
335
 
358
336
        # Out of date bound branch
359
 
        out, err = self.run_bzr('info -v bound')
 
337
        out, err = self.runbzr('info -v bound')
360
338
        self.assertEqualDiff(
361
339
"""Checkout (format: knit)
362
340
Location:
363
 
       checkout root: bound
364
 
  checkout of branch: standalone
 
341
       checkout root: %s
 
342
  checkout of branch: %s
365
343
 
366
344
Related branches:
367
 
  parent branch: standalone
 
345
  parent branch: %s
368
346
 
369
347
Format:
370
348
       control: Meta directory format 1
380
358
         0 added
381
359
         0 removed
382
360
         0 renamed
383
 
         0 unknown
384
 
         1 ignored
 
361
         1 unknown
 
362
         0 ignored
385
363
         0 versioned subdirectories
386
364
 
387
365
Branch history:
388
366
         1 revision
 
367
         1 committer
389
368
         0 days old
390
369
   first revision: %s
391
370
  latest revision: %s
392
371
 
393
372
Repository:
394
373
         1 revision
395
 
""" % (branch3.repository._format.get_format_description(),
 
374
         %d KiB
 
375
""" % (branch3.bzrdir.root_transport.base,
 
376
       branch1.bzrdir.root_transport.base,
 
377
       branch1.bzrdir.root_transport.base,
 
378
       branch3.repository._format.get_format_description(),
396
379
       datestring_first, datestring_first,
 
380
       # poking at _revision_store isn't all that clean, but neither is
 
381
       # having the ui test dependent on the exact overhead of a given store.
 
382
       branch3.repository._revision_store.total_size(
 
383
        branch3.repository.get_transaction())[1] / 1024,
397
384
       ), out)
398
385
        self.assertEqual('', err)
399
386
 
400
387
        # Out of date checkout
401
 
        out, err = self.run_bzr('info -v checkout')
 
388
        out, err = self.runbzr('info -v checkout')
402
389
        self.assertEqualDiff(
403
390
"""Checkout (format: knit)
404
391
Location:
405
 
       checkout root: checkout
406
 
  checkout of branch: standalone
 
392
       checkout root: %s
 
393
  checkout of branch: %s
407
394
 
408
395
Format:
409
396
       control: Meta directory format 1
425
412
 
426
413
Branch history:
427
414
         1 revision
 
415
         1 committer
428
416
         0 days old
429
417
   first revision: %s
430
418
  latest revision: %s
431
419
 
432
420
Repository:
433
421
         1 revision
434
 
""" % (branch4.repository._format.get_format_description(),
 
422
         %d KiB
 
423
""" % (branch4.bzrdir.root_transport.base,
 
424
       branch1.bzrdir.root_transport.base,
 
425
       branch4.repository._format.get_format_description(),
435
426
       datestring_first, datestring_first,
 
427
       # poking at _revision_store isn't all that clean, but neither is
 
428
       # having the ui test dependent on the exact overhead of a given store.
 
429
       branch4.repository._revision_store.total_size(
 
430
        branch4.repository.get_transaction())[1] / 1024,
436
431
       ), out)
437
432
        self.assertEqual('', err)
438
433
 
439
434
        # Out of date lightweight checkout
440
 
        out, err = self.run_bzr('info lightcheckout --verbose')
 
435
        out, err = self.runbzr('info lightcheckout --verbose')
441
436
        self.assertEqualDiff(
442
 
"""Lightweight checkout (format: %s)
 
437
"""Lightweight checkout (format: dirstate or dirstate-tags)
443
438
Location:
444
 
  light checkout root: lightcheckout
445
 
   checkout of branch: standalone
 
439
  light checkout root: %s
 
440
   checkout of branch: %s
446
441
 
447
442
Format:
448
443
       control: Meta directory format 1
449
 
  working tree: Working tree format 6
 
444
  working tree: Working tree format 4
450
445
        branch: Branch format 4
451
446
    repository: Weave repository format 6
452
447
 
464
459
 
465
460
Branch history:
466
461
         2 revisions
 
462
         1 committer
467
463
         0 days old
468
464
   first revision: %s
469
465
  latest revision: %s
470
466
 
471
467
Repository:
472
468
         2 revisions
473
 
""" % (self._repo_strings, datestring_first, datestring_last,), out)
 
469
         0 KiB
 
470
""" % (tree5.bzrdir.root_transport.base,
 
471
       branch1.bzrdir.root_transport.base,
 
472
       datestring_first, datestring_last,
 
473
       ), out)
474
474
        self.assertEqual('', err)
475
475
 
476
476
    def test_info_standalone_no_tree(self):
478
478
        format = bzrdir.format_registry.make_bzrdir('default')
479
479
        branch = self.make_branch('branch')
480
480
        repo = branch.repository
481
 
        out, err = self.run_bzr('info branch -v')
 
481
        out, err = self.runbzr('info branch -v')
482
482
        self.assertEqualDiff(
483
 
"""Standalone branch (format: %s)
 
483
"""Standalone branch (format: dirstate or knit)
484
484
Location:
485
 
  branch root: branch
 
485
  branch root: %s
486
486
 
487
487
Format:
488
488
       control: Meta directory format 1
491
491
 
492
492
Branch history:
493
493
         0 revisions
 
494
         0 committers
494
495
 
495
496
Repository:
496
497
         0 revisions
497
 
""" % (info.describe_format(repo.bzrdir, repo, branch, None),
 
498
         0 KiB
 
499
""" % (branch.bzrdir.root_transport.base,
498
500
       format.get_branch_format().get_format_description(),
499
501
       format.repository_format.get_format_description(),
500
502
       ), out)
507
509
        # Create shared repository
508
510
        repo = self.make_repository('repo', shared=True, format=format)
509
511
        repo.set_make_working_trees(False)
510
 
        out, err = self.run_bzr('info -v repo')
 
512
        out, err = self.runbzr('info -v repo')
511
513
        self.assertEqualDiff(
512
514
"""Shared repository (format: dirstate or dirstate-tags or knit)
513
515
Location:
519
521
 
520
522
Repository:
521
523
         0 revisions
522
 
""" % ('repo', format.repository_format.get_format_description(),
 
524
         0 KiB
 
525
""" % (repo.bzrdir.root_transport.base,
 
526
       format.repository_format.get_format_description(),
523
527
       ), out)
524
528
        self.assertEqual('', err)
525
529
 
527
531
        repo.bzrdir.root_transport.mkdir('branch')
528
532
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch',
529
533
            format=format)
530
 
        out, err = self.run_bzr('info -v repo/branch')
 
534
        out, err = self.runbzr('info -v repo/branch')
531
535
        self.assertEqualDiff(
532
536
"""Repository branch (format: dirstate or knit)
533
537
Location:
534
 
  shared repository: repo
535
 
  repository branch: repo/branch
 
538
  shared repository: %s
 
539
  repository branch: branch
536
540
 
537
541
Format:
538
542
       control: Meta directory format 1
541
545
 
542
546
Branch history:
543
547
         0 revisions
 
548
         0 committers
544
549
 
545
550
Repository:
546
551
         0 revisions
547
 
""" % (format.get_branch_format().get_format_description(),
 
552
         0 KiB
 
553
""" % (repo.bzrdir.root_transport.base,
 
554
       format.get_branch_format().get_format_description(),
548
555
       format.repository_format.get_format_description(),
549
556
       ), out)
550
557
        self.assertEqual('', err)
552
559
        # Create lightweight checkout
553
560
        transport.mkdir('tree')
554
561
        transport.mkdir('tree/lightcheckout')
555
 
        tree2 = branch1.create_checkout('tree/lightcheckout',
 
562
        tree2 = branch1.create_checkout('tree/lightcheckout', 
556
563
            lightweight=True)
557
564
        branch2 = tree2.branch
558
565
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
568
575
        tree2.add('a')
569
576
        tree2.commit('commit one')
570
577
        rev = repo.get_revision(branch2.revision_history()[0])
571
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
572
 
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
 
578
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
579
        out, err = self.runbzr('info tree/lightcheckout --verbose')
573
580
        self.assertEqualDiff(
574
 
"""Lightweight checkout (format: %s)
 
581
"""Lightweight checkout (format: dirstate or dirstate-tags)
575
582
Location:
576
 
  light checkout root: tree/lightcheckout
577
 
   checkout of branch: repo/branch
578
 
    shared repository: repo
 
583
  light checkout root: %s
 
584
   checkout of branch: %s
 
585
    shared repository: %s
579
586
 
580
587
Format:
581
588
       control: Meta directory format 1
582
 
  working tree: Working tree format 6
 
589
  working tree: Working tree format 4
583
590
        branch: %s
584
591
    repository: %s
585
592
 
595
602
 
596
603
Branch history:
597
604
         1 revision
 
605
         1 committer
598
606
         0 days old
599
607
   first revision: %s
600
608
  latest revision: %s
601
609
 
602
610
Repository:
603
611
         1 revision
604
 
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
 
612
         %d KiB
 
613
""" % (tree2.bzrdir.root_transport.base,
 
614
       tree2.branch.bzrdir.root_transport.base,
 
615
       repo.bzrdir.root_transport.base,
 
616
       format.get_branch_format().get_format_description(),
605
617
       format.repository_format.get_format_description(),
606
618
       datestring_first, datestring_first,
 
619
       # poking at _revision_store isn't all that clean, but neither is
 
620
       # having the ui test dependent on the exact overhead of a given store.
 
621
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
607
622
       ), out)
608
623
        self.assertEqual('', err)
609
624
 
610
625
        # Out of date checkout
611
 
        out, err = self.run_bzr('info -v tree/checkout')
 
626
        out, err = self.runbzr('info -v tree/checkout')
612
627
        self.assertEqualDiff(
613
 
"""Checkout (format: unnamed)
 
628
"""Checkout (format: dirstate)
614
629
Location:
615
 
       checkout root: tree/checkout
616
 
  checkout of branch: repo/branch
 
630
       checkout root: %s
 
631
  checkout of branch: %s
617
632
 
618
633
Format:
619
634
       control: Meta directory format 1
620
 
  working tree: Working tree format 6
 
635
  working tree: Working tree format 4
621
636
        branch: %s
622
637
    repository: %s
623
638
 
635
650
 
636
651
Branch history:
637
652
         0 revisions
 
653
         0 committers
638
654
 
639
655
Repository:
640
656
         0 revisions
641
 
""" % (format.get_branch_format().get_format_description(),
 
657
         0 KiB
 
658
""" % (tree3.bzrdir.root_transport.base,
 
659
       branch1.bzrdir.root_transport.base,
 
660
       format.get_branch_format().get_format_description(),
642
661
       format.repository_format.get_format_description(),
643
662
       ), out)
644
663
        self.assertEqual('', err)
647
666
        tree3.update()
648
667
        self.build_tree(['tree/checkout/b'])
649
668
        tree3.add('b')
650
 
        out, err = self.run_bzr('info tree/checkout --verbose')
 
669
        out, err = self.runbzr('info tree/checkout --verbose')
651
670
        self.assertEqualDiff(
652
 
"""Checkout (format: unnamed)
 
671
"""Checkout (format: dirstate)
653
672
Location:
654
 
       checkout root: tree/checkout
655
 
  checkout of branch: repo/branch
 
673
       checkout root: %s
 
674
  checkout of branch: %s
656
675
 
657
676
Format:
658
677
       control: Meta directory format 1
659
 
  working tree: Working tree format 6
 
678
  working tree: Working tree format 4
660
679
        branch: %s
661
680
    repository: %s
662
681
 
672
691
 
673
692
Branch history:
674
693
         1 revision
 
694
         1 committer
675
695
         0 days old
676
696
   first revision: %s
677
697
  latest revision: %s
678
698
 
679
699
Repository:
680
700
         1 revision
681
 
""" % (format.get_branch_format().get_format_description(),
 
701
         %d KiB
 
702
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
 
703
       format.get_branch_format().get_format_description(),
682
704
       format.repository_format.get_format_description(),
683
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,
684
709
       ), out)
685
710
        self.assertEqual('', err)
686
711
        tree3.commit('commit two')
687
712
 
688
713
        # Out of date lightweight checkout
689
714
        rev = repo.get_revision(branch1.revision_history()[-1])
690
 
        datestring_last = osutils.format_date(rev.timestamp, rev.timezone)
691
 
        out, err = self.run_bzr('info tree/lightcheckout --verbose')
 
715
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
716
        out, err = self.runbzr('info tree/lightcheckout --verbose')
692
717
        self.assertEqualDiff(
693
 
"""Lightweight checkout (format: %s)
 
718
"""Lightweight checkout (format: dirstate or dirstate-tags)
694
719
Location:
695
 
  light checkout root: tree/lightcheckout
696
 
   checkout of branch: repo/branch
697
 
    shared repository: repo
 
720
  light checkout root: %s
 
721
   checkout of branch: %s
 
722
    shared repository: %s
698
723
 
699
724
Format:
700
725
       control: Meta directory format 1
701
 
  working tree: Working tree format 6
 
726
  working tree: Working tree format 4
702
727
        branch: %s
703
728
    repository: %s
704
729
 
716
741
 
717
742
Branch history:
718
743
         2 revisions
 
744
         1 committer
719
745
         0 days old
720
746
   first revision: %s
721
747
  latest revision: %s
722
748
 
723
749
Repository:
724
750
         2 revisions
725
 
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
 
751
         %d KiB
 
752
""" % (tree2.bzrdir.root_transport.base,
 
753
       tree2.branch.bzrdir.root_transport.base,
 
754
       repo.bzrdir.root_transport.base,
 
755
       format.get_branch_format().get_format_description(),
726
756
       format.repository_format.get_format_description(),
727
757
       datestring_first, datestring_last,
 
758
       # poking at _revision_store isn't all that clean, but neither is
 
759
       # having the ui test dependent on the exact overhead of a given store.
 
760
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
728
761
       ), out)
729
762
        self.assertEqual('', err)
730
763
 
731
764
        # Show info about shared branch
732
 
        out, err = self.run_bzr('info repo/branch --verbose')
 
765
        out, err = self.runbzr('info repo/branch --verbose')
733
766
        self.assertEqualDiff(
734
767
"""Repository branch (format: dirstate or knit)
735
768
Location:
736
 
  shared repository: repo
737
 
  repository branch: repo/branch
 
769
  shared repository: %s
 
770
  repository branch: branch
738
771
 
739
772
Format:
740
773
       control: Meta directory format 1
743
776
 
744
777
Branch history:
745
778
         2 revisions
 
779
         1 committer
746
780
         0 days old
747
781
   first revision: %s
748
782
  latest revision: %s
749
783
 
750
784
Repository:
751
785
         2 revisions
752
 
""" % (format.get_branch_format().get_format_description(),
 
786
         %d KiB
 
787
""" % (repo.bzrdir.root_transport.base,
 
788
       format.get_branch_format().get_format_description(),
753
789
       format.repository_format.get_format_description(),
754
790
       datestring_first, datestring_last,
 
791
       # poking at _revision_store isn't all that clean, but neither is
 
792
       # having the ui test dependent on the exact overhead of a given store.
 
793
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
755
794
       ), out)
756
795
        self.assertEqual('', err)
757
796
 
758
797
        # Show info about repository with revisions
759
 
        out, err = self.run_bzr('info -v repo')
 
798
        out, err = self.runbzr('info -v repo')
760
799
        self.assertEqualDiff(
761
800
"""Shared repository (format: dirstate or dirstate-tags or knit)
762
801
Location:
763
 
  shared repository: repo
 
802
  shared repository: %s
764
803
 
765
804
Format:
766
805
       control: Meta directory format 1
768
807
 
769
808
Repository:
770
809
         2 revisions
771
 
""" % (format.repository_format.get_format_description(),
 
810
         %d KiB
 
811
""" % (repo.bzrdir.root_transport.base,
 
812
       format.repository_format.get_format_description(),
 
813
       # poking at _revision_store isn't all that clean, but neither is
 
814
       # having the ui test dependent on the exact overhead of a given store.
 
815
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
772
816
       ), out)
773
817
        self.assertEqual('', err)
774
818
 
779
823
        # Create shared repository with working trees
780
824
        repo = self.make_repository('repo', shared=True, format=format)
781
825
        repo.set_make_working_trees(True)
782
 
        out, err = self.run_bzr('info -v repo')
 
826
        out, err = self.runbzr('info -v repo')
783
827
        self.assertEqualDiff(
784
828
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
785
829
Location:
786
 
  shared repository: repo
 
830
  shared repository: %s
787
831
 
788
832
Format:
789
833
       control: Meta directory format 1
793
837
 
794
838
Repository:
795
839
         0 revisions
796
 
""" % (format.repository_format.get_format_description(),
 
840
         0 KiB
 
841
""" % (repo.bzrdir.root_transport.base,
 
842
       format.repository_format.get_format_description(),
797
843
       ), out)
798
844
        self.assertEqual('', err)
799
845
 
804
850
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
805
851
 
806
852
        # Empty first branch
807
 
        out, err = self.run_bzr('info repo/branch1 --verbose')
 
853
        out, err = self.runbzr('info repo/branch1 --verbose')
808
854
        self.assertEqualDiff(
809
855
"""Repository tree (format: knit)
810
856
Location:
811
 
  shared repository: repo
812
 
  repository branch: repo/branch1
 
857
  shared repository: %s
 
858
  repository branch: branch1
813
859
 
814
860
Format:
815
861
       control: Meta directory format 1
829
875
 
830
876
Branch history:
831
877
         0 revisions
 
878
         0 committers
832
879
 
833
880
Repository:
834
881
         0 revisions
835
 
""" % (format.get_branch_format().get_format_description(),
 
882
         0 KiB
 
883
""" % (repo.bzrdir.root_transport.base,
 
884
       format.get_branch_format().get_format_description(),
836
885
       format.repository_format.get_format_description(),
837
886
       ), out)
838
887
        self.assertEqual('', err)
843
892
        tree1.add('a')
844
893
        tree1.commit('commit one')
845
894
        rev = repo.get_revision(branch1.revision_history()[0])
846
 
        datestring_first = osutils.format_date(rev.timestamp, rev.timezone)
847
 
        out, err = self.run_bzr('info -v repo/branch1')
 
895
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
896
        out, err = self.runbzr('info -v repo/branch1')
848
897
        self.assertEqualDiff(
849
898
"""Repository tree (format: knit)
850
899
Location:
851
 
  shared repository: repo
852
 
  repository branch: repo/branch1
 
900
  shared repository: %s
 
901
  repository branch: branch1
853
902
 
854
903
Format:
855
904
       control: Meta directory format 1
869
918
 
870
919
Branch history:
871
920
         1 revision
 
921
         1 committer
872
922
         0 days old
873
923
   first revision: %s
874
924
  latest revision: %s
875
925
 
876
926
Repository:
877
927
         1 revision
878
 
""" % (format.get_branch_format().get_format_description(),
 
928
         %d KiB
 
929
""" % (repo.bzrdir.root_transport.base,
 
930
       format.get_branch_format().get_format_description(),
879
931
       format.repository_format.get_format_description(),
880
932
       datestring_first, datestring_first,
 
933
       # poking at _revision_store isn't all that clean, but neither is
 
934
       # having the ui test dependent on the exact overhead of a given store.
 
935
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
881
936
       ), out)
882
937
        self.assertEqual('', err)
883
938
 
884
939
        # Out of date second branch
885
 
        out, err = self.run_bzr('info repo/branch2 --verbose')
 
940
        out, err = self.runbzr('info repo/branch2 --verbose')
886
941
        self.assertEqualDiff(
887
942
"""Repository tree (format: knit)
888
943
Location:
889
 
  shared repository: repo
890
 
  repository branch: repo/branch2
 
944
  shared repository: %s
 
945
  repository branch: branch2
891
946
 
892
947
Related branches:
893
 
  parent branch: repo/branch1
 
948
  parent branch: %s
894
949
 
895
950
Format:
896
951
       control: Meta directory format 1
910
965
 
911
966
Branch history:
912
967
         0 revisions
 
968
         0 committers
913
969
 
914
970
Repository:
915
971
         1 revision
916
 
""" % (format.get_branch_format().get_format_description(),
 
972
         %d KiB
 
973
""" % (repo.bzrdir.root_transport.base,
 
974
       branch1.bzrdir.root_transport.base,
 
975
       format.get_branch_format().get_format_description(),
917
976
       format.repository_format.get_format_description(),
 
977
       # poking at _revision_store isn't all that clean, but neither is
 
978
       # having the ui test dependent on the exact overhead of a given store.
 
979
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
918
980
       ), out)
919
981
        self.assertEqual('', err)
920
982
 
921
983
        # Update second branch
922
984
        tree2 = branch2.bzrdir.open_workingtree()
923
985
        tree2.pull(branch1)
924
 
        out, err = self.run_bzr('info -v repo/branch2')
 
986
        out, err = self.runbzr('info -v repo/branch2')
925
987
        self.assertEqualDiff(
926
988
"""Repository tree (format: knit)
927
989
Location:
928
 
  shared repository: repo
929
 
  repository branch: repo/branch2
 
990
  shared repository: %s
 
991
  repository branch: branch2
930
992
 
931
993
Related branches:
932
 
  parent branch: repo/branch1
 
994
  parent branch: %s
933
995
 
934
996
Format:
935
997
       control: Meta directory format 1
949
1011
 
950
1012
Branch history:
951
1013
         1 revision
 
1014
         1 committer
952
1015
         0 days old
953
1016
   first revision: %s
954
1017
  latest revision: %s
955
1018
 
956
1019
Repository:
957
1020
         1 revision
958
 
""" % (format.get_branch_format().get_format_description(),
 
1021
         %d KiB
 
1022
""" % (repo.bzrdir.root_transport.base,
 
1023
       branch1.bzrdir.root_transport.base,
 
1024
       format.get_branch_format().get_format_description(),
959
1025
       format.repository_format.get_format_description(),
960
1026
       datestring_first, datestring_first,
 
1027
       # poking at _revision_store isn't all that clean, but neither is
 
1028
       # having the ui test dependent on the exact overhead of a given store.
 
1029
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
961
1030
       ), out)
962
1031
        self.assertEqual('', err)
963
1032
 
964
1033
        # Show info about repository with revisions
965
 
        out, err = self.run_bzr('info -v repo')
 
1034
        out, err = self.runbzr('info -v repo')
966
1035
        self.assertEqualDiff(
967
1036
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
968
1037
Location:
969
 
  shared repository: repo
 
1038
  shared repository: %s
970
1039
 
971
1040
Format:
972
1041
       control: Meta directory format 1
976
1045
 
977
1046
Repository:
978
1047
         1 revision
979
 
""" % (format.repository_format.get_format_description(),
 
1048
         %d KiB
 
1049
""" % (repo.bzrdir.root_transport.base,
 
1050
       format.repository_format.get_format_description(),
 
1051
       # poking at _revision_store isn't all that clean, but neither is
 
1052
       # having the ui test dependent on the exact overhead of a given store.
 
1053
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
980
1054
       ),
981
1055
       out)
982
1056
        self.assertEqual('', err)
983
 
 
 
1057
    
984
1058
    def test_info_shared_repository_with_tree_in_root(self):
985
1059
        format = bzrdir.format_registry.make_bzrdir('knit')
986
1060
        transport = self.get_transport()
988
1062
        # Create shared repository with working trees
989
1063
        repo = self.make_repository('repo', shared=True, format=format)
990
1064
        repo.set_make_working_trees(True)
991
 
        out, err = self.run_bzr('info -v repo')
 
1065
        out, err = self.runbzr('info -v repo')
992
1066
        self.assertEqualDiff(
993
1067
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
994
1068
Location:
995
 
  shared repository: repo
 
1069
  shared repository: %s
996
1070
 
997
1071
Format:
998
1072
       control: Meta directory format 1
1002
1076
 
1003
1077
Repository:
1004
1078
         0 revisions
1005
 
""" % (format.repository_format.get_format_description(),
 
1079
         0 KiB
 
1080
""" % (repo.bzrdir.root_transport.base,
 
1081
       format.repository_format.get_format_description(),
1006
1082
       ), out)
1007
1083
        self.assertEqual('', err)
1008
1084
 
1010
1086
        control = repo.bzrdir
1011
1087
        branch = control.create_branch()
1012
1088
        control.create_workingtree()
1013
 
        out, err = self.run_bzr('info -v repo')
 
1089
        out, err = self.runbzr('info -v repo')
1014
1090
        self.assertEqualDiff(
1015
1091
"""Repository tree (format: knit)
1016
1092
Location:
1017
 
  shared repository: repo
1018
 
  repository branch: repo
 
1093
  shared repository: %s
 
1094
  repository branch: .
1019
1095
 
1020
1096
Format:
1021
1097
       control: Meta directory format 1
1035
1111
 
1036
1112
Branch history:
1037
1113
         0 revisions
 
1114
         0 committers
1038
1115
 
1039
1116
Repository:
1040
1117
         0 revisions
1041
 
""" % (format.get_branch_format().get_format_description(),
 
1118
         0 KiB
 
1119
""" % (repo.bzrdir.root_transport.base,
 
1120
       format.get_branch_format().get_format_description(),
1042
1121
       format.repository_format.get_format_description(),
1043
1122
       ), out)
1044
1123
        self.assertEqual('', err)
1045
1124
 
1046
 
    def test_info_repository_hook(self):
1047
 
        format = bzrdir.format_registry.make_bzrdir('knit')
1048
 
        def repo_info(repo, stats, outf):
1049
 
            outf.write("more info\n")
1050
 
        info.hooks.install_named_hook('repository', repo_info, None)
1051
 
        # Create shared repository with working trees
1052
 
        repo = self.make_repository('repo', shared=True, format=format)
1053
 
        out, err = self.run_bzr('info -v repo')
1054
 
        self.assertEqualDiff(
1055
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
1056
 
Location:
1057
 
  shared repository: repo
1058
 
 
1059
 
Format:
1060
 
       control: Meta directory format 1
1061
 
    repository: %s
1062
 
 
1063
 
Create working tree for new branches inside the repository.
1064
 
 
1065
 
Repository:
1066
 
         0 revisions
1067
 
more info
1068
 
""" % (format.repository_format.get_format_description(),
1069
 
       ), out)
1070
 
        self.assertEqual('', err)
1071
 
 
1072
 
    def assertCheckoutStatusOutput(self,
 
1125
    def assertCheckoutStatusOutput(self, 
1073
1126
        command_string, lco_tree, shared_repo=None,
1074
1127
        repo_branch=None,
1075
1128
        tree_locked=False,
1084
1137
        allow us, the test writers, to document what *should* be present in
1085
1138
        the output. Removing this separation would remove the value of the
1086
1139
        tests.
1087
 
 
 
1140
        
1088
1141
        :param path: the path to the light checkout.
1089
1142
        :param lco_tree: the tree object for the light checkout.
1090
1143
        :param shared_repo: A shared repository is in use, expect that in
1094
1147
        :param tree_locked: If true, expect the tree to be locked.
1095
1148
        :param branch_locked: If true, expect the branch to be locked.
1096
1149
        :param repo_locked: If true, expect the repository to be locked.
1097
 
            Note that the lco_tree.branch.repository is inspected, and if is not
1098
 
            actually locked then this parameter is overridden. This is because
1099
 
            pack repositories do not have any public API for obtaining an
1100
 
            exclusive repository wide lock.
1101
 
        :param verbose: verbosity level: 2 or higher to show committers
 
1150
        :param verbose: If true, expect verbose output
1102
1151
        """
1103
 
        def friendly_location(url):
1104
 
            path = urlutils.unescape_for_display(url, 'ascii')
1105
 
            try:
1106
 
                return osutils.relpath(osutils.getcwd(), path)
1107
 
            except errors.PathNotChild:
1108
 
                return path
1109
 
 
1110
 
        if tree_locked:
1111
 
            # We expect this to fail because of locking errors.
1112
 
            # (A write-locked file cannot be read-locked
1113
 
            # in the different process -- either on win32 or on linux).
 
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).
1114
1155
            # This should be removed when the locking errors are fixed.
1115
 
            self.expectFailure('OS locks are exclusive '
1116
 
                'for different processes (Bug #174055)',
1117
 
                self.run_bzr_subprocess,
1118
 
                'info ' + command_string)
1119
 
        out, err = self.run_bzr('info %s' % command_string)
 
1156
            args = command_string.split(' ')
 
1157
            self.run_bzr_error([], 'info', *args)
 
1158
            return
 
1159
        out, err = self.runbzr('info %s' % command_string)
1120
1160
        description = {
1121
1161
            (True, True): 'Lightweight checkout',
1122
1162
            (True, False): 'Repository checkout',
1123
1163
            (False, True): 'Lightweight checkout',
1124
1164
            (False, False): 'Checkout',
1125
1165
            }[(shared_repo is not None, light_checkout)]
1126
 
        format = {True: self._repo_strings,
1127
 
                  False: 'unnamed'}[light_checkout]
1128
 
        if repo_locked:
1129
 
            repo_locked = lco_tree.branch.repository.get_physical_lock_status()
 
1166
        format = {True: 'dirstate or dirstate-tags',
 
1167
                  False: 'dirstate'}[light_checkout]
1130
1168
        if repo_locked or branch_locked or tree_locked:
1131
1169
            def locked_message(a_bool):
1132
1170
                if a_bool:
1148
1186
        extra_space = ''
1149
1187
        if light_checkout:
1150
1188
            tree_data = ("  light checkout root: %s\n" %
1151
 
                friendly_location(lco_tree.bzrdir.root_transport.base))
 
1189
                lco_tree.bzrdir.root_transport.base)
1152
1190
            extra_space = ' '
1153
1191
        if lco_tree.branch.get_bound_location() is not None:
1154
1192
            tree_data += ("%s       checkout root: %s\n" % (extra_space,
1155
 
                friendly_location(lco_tree.branch.bzrdir.root_transport.base)))
 
1193
                lco_tree.branch.bzrdir.root_transport.base))
1156
1194
        if shared_repo is not None:
1157
1195
            branch_data = (
1158
1196
                "   checkout of branch: %s\n"
1159
1197
                "    shared repository: %s\n" %
1160
 
                (friendly_location(repo_branch.bzrdir.root_transport.base),
1161
 
                 friendly_location(shared_repo.bzrdir.root_transport.base)))
 
1198
                (repo_branch.bzrdir.root_transport.base,
 
1199
                 shared_repo.bzrdir.root_transport.base))
1162
1200
        elif repo_branch is not None:
1163
1201
            branch_data = (
1164
1202
                "%s  checkout of branch: %s\n" %
1165
1203
                (extra_space,
1166
 
                 friendly_location(repo_branch.bzrdir.root_transport.base)))
 
1204
                 repo_branch.bzrdir.root_transport.base))
1167
1205
        else:
1168
1206
            branch_data = ("   checkout of branch: %s\n" %
1169
1207
                lco_tree.branch.bzrdir.root_transport.base)
1170
 
 
1171
 
        if verbose >= 2:
 
1208
        
 
1209
        if verbose:
1172
1210
            verbose_info = '         0 committers\n'
1173
1211
        else:
1174
1212
            verbose_info = ''
1175
 
 
 
1213
            
1176
1214
        self.assertEqualDiff(
1177
1215
"""%s (format: %s)
1178
1216
Location:
1198
1236
%s
1199
1237
Repository:
1200
1238
         0 revisions
 
1239
         0 KiB
1201
1240
""" %  (description,
1202
1241
        format,
1203
1242
        tree_data,
1214
1253
        transport = self.get_transport()
1215
1254
        # Create shared repository with a branch
1216
1255
        repo = self.make_repository('repo', shared=True,
1217
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1256
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1218
1257
        repo.set_make_working_trees(False)
1219
1258
        repo.bzrdir.root_transport.mkdir('branch')
1220
1259
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1260
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1222
1261
        # Do a heavy checkout
1223
1262
        transport.mkdir('tree')
1224
1263
        transport.mkdir('tree/checkout')
1225
 
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
 
            format=bzrdir.BzrDirMetaFormat1())
 
1264
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1265
            format=bzrlib.bzrdir.BzrDirMetaFormat1())
1227
1266
        co_branch.bind(repo_branch)
1228
1267
        # Do a light checkout of the heavy one
1229
1268
        transport.mkdir('tree/lightcheckout')
1230
 
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
 
        branch.BranchReferenceFormat().initialize(lco_dir,
1232
 
            target_branch=co_branch)
 
1269
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1270
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1233
1271
        lco_dir.create_workingtree()
1234
1272
        lco_tree = lco_dir.open_workingtree()
1235
1273
 
1325
1363
 
1326
1364
    def test_info_locking_oslocks(self):
1327
1365
        if sys.platform == "win32":
1328
 
            self.skip("don't use oslocks on win32 in unix manner")
1329
 
        # This test tests old (all-in-one, OS lock using) behaviour which
1330
 
        # simply cannot work on windows (and is indeed why we changed our
1331
 
        # design. As such, don't try to remove the thisFailsStrictLockCheck
1332
 
        # call here.
1333
 
        self.thisFailsStrictLockCheck()
 
1366
            raise TestSkipped("don't use oslocks on win32 in unix manner")
1334
1367
 
1335
1368
        tree = self.make_branch_and_tree('branch',
1336
 
                                         format=bzrdir.BzrDirFormat6())
 
1369
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1337
1370
 
1338
1371
        # Test all permutations of locking the working tree, branch and repository
1339
1372
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1342
1375
        # W B R
1343
1376
 
1344
1377
        # U U U
1345
 
        out, err = self.run_bzr('info -v branch')
 
1378
        out, err = self.runbzr('info -v branch')
1346
1379
        self.assertEqualDiff(
1347
1380
"""Standalone tree (format: weave)
1348
1381
Location:
1366
1399
 
1367
1400
Branch history:
1368
1401
         0 revisions
 
1402
         0 committers
1369
1403
 
1370
1404
Repository:
1371
1405
         0 revisions
1372
 
""" % ('branch', tree.branch.repository._format.get_format_description(),
 
1406
         0 KiB
 
1407
""" % (tree.bzrdir.root_transport.base,
 
1408
       tree.branch.repository._format.get_format_description(),
1373
1409
       ), out)
1374
1410
        self.assertEqual('', err)
1375
1411
        # L L L
1376
1412
        tree.lock_write()
1377
 
        out, err = self.run_bzr('info -v branch')
 
1413
        out, err = self.runbzr('info -v branch')
1378
1414
        self.assertEqualDiff(
1379
1415
"""Standalone tree (format: weave)
1380
1416
Location:
1398
1434
 
1399
1435
Branch history:
1400
1436
         0 revisions
 
1437
         0 committers
1401
1438
 
1402
1439
Repository:
1403
1440
         0 revisions
1404
 
""" % ('branch', tree.branch.repository._format.get_format_description(),
 
1441
         0 KiB
 
1442
""" % (tree.bzrdir.root_transport.base,
 
1443
       tree.branch.repository._format.get_format_description(),
1405
1444
       ), out)
1406
1445
        self.assertEqual('', err)
1407
1446
        tree.unlock()
1408
 
 
1409
 
    def test_info_stacked(self):
1410
 
        # We have a mainline
1411
 
        trunk_tree = self.make_branch_and_tree('mainline',
1412
 
            format='1.6')
1413
 
        trunk_tree.commit('mainline')
1414
 
        # and a branch from it which is stacked
1415
 
        new_dir = trunk_tree.bzrdir.sprout('newbranch', stacked=True)
1416
 
        out, err = self.run_bzr('info newbranch')
1417
 
        self.assertEqual(
1418
 
"""Standalone tree (format: 1.6)
1419
 
Location:
1420
 
  branch root: newbranch
1421
 
 
1422
 
Related branches:
1423
 
  parent branch: mainline
1424
 
     stacked on: mainline
1425
 
""", out)
1426
 
        self.assertEqual("", err)