/brz/remove-bazaar

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

« back to all changes in this revision

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

urlutils.join should work for root paths.

Show diffs side-by-side

added added

removed removed

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