~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2007-06-06 14:26:08 UTC
  • mto: (2485.8.44 bzr.connection.sharing)
  • mto: This revision was merged to the branch mainline in revision 2646.
  • Revision ID: v.ladeuil+lp@free.fr-20070606142608-i9ufaqewadslf1cn
Finish sftp refactoring. Test suite passing.

* bzrlib/transport/sftp.py:
(clear_connection_cache): Deprecated.
(_sftp_connect, _sftp_connect_uncached): Deleted.
(SFTPTransport.__init__): Simplified.
(SFTPTransport._create_connection): New method. Copied from
_sftp_connect_uncached
(SFTPTransport._get_sftp): New method. Ensures that the connection
is established.
(SFTPTransport.clone): Deleted.
(SFTPTransport.has, SFTPTransport.get, SFTPTransport.readv,
SFTPTransport._put,
SFTPTransport._put_non_atomic_helper._open_and_write_file,
SFTPTransport._mkdir, SFTPTransport.append_file,
SFTPTransport.rename, SFTPTransport._rename_and_overwrite,
SFTPTransport.delete, SFTPTransport.rmdir, SFTPTransport.stat):
Use _get_sftp.

* bzrlib/tests/test_transport_implementations.py:
(TransportTests.test_connection_error): Simplified now that sftp
does not connection on construction.

* bzrlib/tests/test_sftp_transport.py:
(SFTPLockTests.test_sftp_locks): Delete test_multiple_connections.
(FakeSFTPTransport): Deleted.
(SFTPNonServerTest.test_parse_url_with_home_dir,
SFTPNonServerTest.test_relpath,
SSHVendorBadConnection.test_bad_connection_paramiko): Delete the
from_transport parameter as it's not needed anymore.
(SFTPLatencyKnob.test_latency_knob_slows_transport,
SFTPLatencyKnob.test_default): Force connection by issuing a
request.

Show diffs side-by-side

added added

removed removed

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