~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-05-24 00:06:33 UTC
  • mto: This revision was merged to the branch mainline in revision 1740.
  • Revision ID: mbp@sourcefrog.net-20060524000633-02937e5715bac1c7
Remove duplicated RevisionSpec_revs (guillaume)

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