~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2006-10-14 08:51:07 UTC
  • mto: (2080.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2081.
  • Revision ID: bialix@ukr.net-20061014085107-8dff865674eed30a
win32 installer: make short info page instead of full GPL license text

Show diffs side-by-side

added added

removed removed

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