/brz/remove-bazaar

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

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-05-12 08:29:23 UTC
  • mfrom: (1668.1.7 bzr-0.8.mbp)
  • mto: This revision was merged to the branch mainline in revision 1710.
  • Revision ID: mbp@sourcefrog.net-20060512082923-38e14b057e08246e
[merge] work from 0.8 fixes

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)
474
 
        self.assertEqual('', err)
475
 
 
476
 
    def test_info_standalone_no_tree(self):
477
 
        # create standalone branch without a working tree
478
 
        format = bzrdir.format_registry.make_bzrdir('default')
479
 
        branch = self.make_branch('branch')
480
 
        repo = branch.repository
481
 
        out, err = self.run_bzr('info branch -v')
482
 
        self.assertEqualDiff(
483
 
"""Standalone branch (format: %s)
484
 
Location:
485
 
  branch root: branch
486
 
 
487
 
Format:
488
 
       control: Meta directory format 1
489
 
        branch: %s
490
 
    repository: %s
491
 
 
492
 
Branch history:
493
 
         0 revisions
494
 
 
495
 
Repository:
496
 
         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(),
 
456
         0 KiB
 
457
""" % (tree5.bzrdir.root_transport.base,
 
458
       branch1.bzrdir.root_transport.base,
 
459
       datestring_first, datestring_last,
500
460
       ), out)
501
461
        self.assertEqual('', err)
502
462
 
503
463
    def test_info_shared_repository(self):
504
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
464
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
465
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
505
466
        transport = self.get_transport()
506
467
 
507
468
        # Create shared repository
508
 
        repo = self.make_repository('repo', shared=True, format=format)
 
469
        repo = self.make_repository('repo', shared=True)
509
470
        repo.set_make_working_trees(False)
510
 
        out, err = self.run_bzr('info -v repo')
 
471
        out, err = self.runbzr('info repo')
511
472
        self.assertEqualDiff(
512
 
"""Shared repository (format: dirstate or dirstate-tags or knit)
513
 
Location:
 
473
"""Location:
514
474
  shared repository: %s
515
475
 
516
476
Format:
517
477
       control: Meta directory format 1
518
478
    repository: %s
519
479
 
520
 
Repository:
 
480
Revision store:
521
481
         0 revisions
522
 
""" % ('repo', format.repository_format.get_format_description(),
 
482
         0 KiB
 
483
""" % (repo.bzrdir.root_transport.base,
 
484
       repo._format.get_format_description(),
523
485
       ), out)
524
486
        self.assertEqual('', err)
525
487
 
526
488
        # Create branch inside shared repository
527
489
        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')
 
490
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch')
 
491
        out, err = self.runbzr('info repo/branch')
531
492
        self.assertEqualDiff(
532
 
"""Repository branch (format: dirstate or knit)
533
 
Location:
534
 
  shared repository: repo
535
 
  repository branch: repo/branch
 
493
"""Location:
 
494
  shared repository: %s
 
495
  repository branch: branch
536
496
 
537
497
Format:
538
498
       control: Meta directory format 1
539
 
        branch: %s
 
499
        branch: Branch format 5
540
500
    repository: %s
541
501
 
542
502
Branch history:
543
503
         0 revisions
544
504
 
545
 
Repository:
 
505
Revision store:
546
506
         0 revisions
547
 
""" % (format.get_branch_format().get_format_description(),
548
 
       format.repository_format.get_format_description(),
 
507
         0 KiB
 
508
""" % (repo.bzrdir.root_transport.base,
 
509
       repo._format.get_format_description(),
549
510
       ), out)
550
511
        self.assertEqual('', err)
551
512
 
552
513
        # Create lightweight checkout
553
514
        transport.mkdir('tree')
554
515
        transport.mkdir('tree/lightcheckout')
555
 
        tree2 = branch1.create_checkout('tree/lightcheckout',
556
 
            lightweight=True)
 
516
        dir2 = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
517
        bzrlib.branch.BranchReferenceFormat().initialize(dir2, branch1)
 
518
        dir2.create_workingtree()
 
519
        tree2 = dir2.open_workingtree()
557
520
        branch2 = tree2.branch
558
 
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', tree2,
559
 
                   shared_repo=repo, repo_branch=branch1, verbose=True)
 
521
        out, err = self.runbzr('info tree/lightcheckout')
 
522
        self.assertEqualDiff(
 
523
"""Location:
 
524
  light checkout root: %s
 
525
    shared repository: %s
 
526
    repository branch: branch
 
527
 
 
528
Format:
 
529
       control: Meta directory format 1
 
530
  working tree: Working tree format 3
 
531
        branch: Branch format 5
 
532
    repository: %s
 
533
 
 
534
In the working tree:
 
535
         0 unchanged
 
536
         0 modified
 
537
         0 added
 
538
         0 removed
 
539
         0 renamed
 
540
         0 unknown
 
541
         0 ignored
 
542
         0 versioned subdirectories
 
543
 
 
544
Branch history:
 
545
         0 revisions
 
546
 
 
547
Revision store:
 
548
         0 revisions
 
549
         0 KiB
 
550
""" % (tree2.bzrdir.root_transport.base,
 
551
       repo.bzrdir.root_transport.base,
 
552
       repo._format.get_format_description(),
 
553
       ), out)
 
554
        self.assertEqual('', err)
560
555
 
561
556
        # 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)
 
557
        branch3 = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout')
 
558
        branch3.bind(branch1)
 
559
        tree3 = branch3.bzrdir.open_workingtree()
 
560
        tree3.update()
 
561
        out, err = self.runbzr('info tree/checkout --verbose')
 
562
        self.assertEqualDiff(
 
563
"""Location:
 
564
       checkout root: %s
 
565
  checkout of branch: %s
 
566
 
 
567
Format:
 
568
       control: Meta directory format 1
 
569
  working tree: Working tree format 3
 
570
        branch: Branch format 5
 
571
    repository: %s
 
572
 
 
573
In the working tree:
 
574
         0 unchanged
 
575
         0 modified
 
576
         0 added
 
577
         0 removed
 
578
         0 renamed
 
579
         0 unknown
 
580
         0 ignored
 
581
         0 versioned subdirectories
 
582
 
 
583
Branch history:
 
584
         0 revisions
 
585
         0 committers
 
586
 
 
587
Revision store:
 
588
         0 revisions
 
589
         0 KiB
 
590
""" % (branch3.bzrdir.root_transport.base,
 
591
       branch1.bzrdir.root_transport.base,
 
592
       repo._format.get_format_description(),
 
593
       ), out)
 
594
        self.assertEqual('', err)
 
595
 
566
596
        # Update lightweight checkout
567
597
        self.build_tree(['tree/lightcheckout/a'])
568
598
        tree2.add('a')
569
599
        tree2.commit('commit one')
570
600
        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')
 
601
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
602
        out, err = self.runbzr('info tree/lightcheckout --verbose')
573
603
        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
 
604
"""Location:
 
605
  light checkout root: %s
 
606
    shared repository: %s
 
607
    repository branch: branch
579
608
 
580
609
Format:
581
610
       control: Meta directory format 1
582
 
  working tree: Working tree format 6
583
 
        branch: %s
 
611
  working tree: Working tree format 3
 
612
        branch: Branch format 5
584
613
    repository: %s
585
614
 
586
615
In the working tree:
595
624
 
596
625
Branch history:
597
626
         1 revision
 
627
         1 committer
598
628
         0 days old
599
629
   first revision: %s
600
630
  latest revision: %s
601
631
 
602
 
Repository:
 
632
Revision store:
603
633
         1 revision
604
 
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
605
 
       format.repository_format.get_format_description(),
 
634
         %d KiB
 
635
""" % (tree2.bzrdir.root_transport.base,
 
636
       repo.bzrdir.root_transport.base,
 
637
       repo._format.get_format_description(),
606
638
       datestring_first, datestring_first,
 
639
       # poking at _revision_store isn't all that clean, but neither is
 
640
       # having the ui test dependent on the exact overhead of a given store.
 
641
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
607
642
       ), out)
608
643
        self.assertEqual('', err)
609
644
 
610
645
        # Out of date checkout
611
 
        out, err = self.run_bzr('info -v tree/checkout')
 
646
        out, err = self.runbzr('info tree/checkout')
612
647
        self.assertEqualDiff(
613
 
"""Checkout (format: unnamed)
614
 
Location:
615
 
       checkout root: tree/checkout
616
 
  checkout of branch: repo/branch
 
648
"""Location:
 
649
       checkout root: %s
 
650
  checkout of branch: %s
617
651
 
618
652
Format:
619
653
       control: Meta directory format 1
620
 
  working tree: Working tree format 6
621
 
        branch: %s
 
654
  working tree: Working tree format 3
 
655
        branch: Branch format 5
622
656
    repository: %s
623
657
 
624
658
Branch is out of date: missing 1 revision.
636
670
Branch history:
637
671
         0 revisions
638
672
 
639
 
Repository:
 
673
Revision store:
640
674
         0 revisions
641
 
""" % (format.get_branch_format().get_format_description(),
642
 
       format.repository_format.get_format_description(),
 
675
         0 KiB
 
676
""" % (tree3.bzrdir.root_transport.base,
 
677
       branch1.bzrdir.root_transport.base,
 
678
       repo._format.get_format_description(),
643
679
       ), out)
644
680
        self.assertEqual('', err)
645
681
 
647
683
        tree3.update()
648
684
        self.build_tree(['tree/checkout/b'])
649
685
        tree3.add('b')
650
 
        out, err = self.run_bzr('info tree/checkout --verbose')
 
686
        out, err = self.runbzr('info tree/checkout --verbose')
651
687
        self.assertEqualDiff(
652
 
"""Checkout (format: unnamed)
653
 
Location:
654
 
       checkout root: tree/checkout
655
 
  checkout of branch: repo/branch
 
688
"""Location:
 
689
       checkout root: %s
 
690
  checkout of branch: %s
656
691
 
657
692
Format:
658
693
       control: Meta directory format 1
659
 
  working tree: Working tree format 6
660
 
        branch: %s
 
694
  working tree: Working tree format 3
 
695
        branch: Branch format 5
661
696
    repository: %s
662
697
 
663
698
In the working tree:
672
707
 
673
708
Branch history:
674
709
         1 revision
 
710
         1 committer
675
711
         0 days old
676
712
   first revision: %s
677
713
  latest revision: %s
678
714
 
679
 
Repository:
 
715
Revision store:
680
716
         1 revision
681
 
""" % (format.get_branch_format().get_format_description(),
682
 
       format.repository_format.get_format_description(),
 
717
         %d KiB
 
718
""" % (tree3.bzrdir.root_transport.base, branch1.bzrdir.root_transport.base,
 
719
       repo._format.get_format_description(),
683
720
       datestring_first, datestring_first,
 
721
       # poking at _revision_store isn't all that clean, but neither is
 
722
       # having the ui test dependent on the exact overhead of a given store.
 
723
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
684
724
       ), out)
685
725
        self.assertEqual('', err)
686
726
        tree3.commit('commit two')
687
727
 
688
728
        # Out of date lightweight checkout
689
729
        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')
 
730
        datestring_last = format_date(rev.timestamp, rev.timezone)
 
731
        out, err = self.runbzr('info tree/lightcheckout --verbose')
692
732
        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
 
733
"""Location:
 
734
  light checkout root: %s
 
735
    shared repository: %s
 
736
    repository branch: branch
698
737
 
699
738
Format:
700
739
       control: Meta directory format 1
701
 
  working tree: Working tree format 6
702
 
        branch: %s
 
740
  working tree: Working tree format 3
 
741
        branch: Branch format 5
703
742
    repository: %s
704
743
 
705
744
Working tree is out of date: missing 1 revision.
716
755
 
717
756
Branch history:
718
757
         2 revisions
 
758
         1 committer
719
759
         0 days old
720
760
   first revision: %s
721
761
  latest revision: %s
722
762
 
723
 
Repository:
 
763
Revision store:
724
764
         2 revisions
725
 
""" % (self._repo_strings, format.get_branch_format().get_format_description(),
726
 
       format.repository_format.get_format_description(),
 
765
         %d KiB
 
766
""" % (tree2.bzrdir.root_transport.base,
 
767
       repo.bzrdir.root_transport.base,
 
768
       repo._format.get_format_description(),
727
769
       datestring_first, datestring_last,
 
770
       # poking at _revision_store isn't all that clean, but neither is
 
771
       # having the ui test dependent on the exact overhead of a given store.
 
772
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
728
773
       ), out)
729
774
        self.assertEqual('', err)
730
775
 
731
776
        # Show info about shared branch
732
 
        out, err = self.run_bzr('info repo/branch --verbose')
 
777
        out, err = self.runbzr('info repo/branch --verbose')
733
778
        self.assertEqualDiff(
734
 
"""Repository branch (format: dirstate or knit)
735
 
Location:
736
 
  shared repository: repo
737
 
  repository branch: repo/branch
 
779
"""Location:
 
780
  shared repository: %s
 
781
  repository branch: branch
738
782
 
739
783
Format:
740
784
       control: Meta directory format 1
741
 
        branch: %s
 
785
        branch: Branch format 5
742
786
    repository: %s
743
787
 
744
788
Branch history:
745
789
         2 revisions
 
790
         1 committer
746
791
         0 days old
747
792
   first revision: %s
748
793
  latest revision: %s
749
794
 
750
 
Repository:
 
795
Revision store:
751
796
         2 revisions
752
 
""" % (format.get_branch_format().get_format_description(),
753
 
       format.repository_format.get_format_description(),
 
797
         %d KiB
 
798
""" % (repo.bzrdir.root_transport.base,
 
799
       repo._format.get_format_description(),
754
800
       datestring_first, datestring_last,
 
801
       # poking at _revision_store isn't all that clean, but neither is
 
802
       # having the ui test dependent on the exact overhead of a given store.
 
803
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
755
804
       ), out)
756
805
        self.assertEqual('', err)
757
806
 
758
807
        # Show info about repository with revisions
759
 
        out, err = self.run_bzr('info -v repo')
 
808
        out, err = self.runbzr('info repo')
760
809
        self.assertEqualDiff(
761
 
"""Shared repository (format: dirstate or dirstate-tags or knit)
762
 
Location:
763
 
  shared repository: repo
 
810
"""Location:
 
811
  shared repository: %s
764
812
 
765
813
Format:
766
814
       control: Meta directory format 1
767
815
    repository: %s
768
816
 
769
 
Repository:
 
817
Revision store:
770
818
         2 revisions
771
 
""" % (format.repository_format.get_format_description(),
 
819
         %d KiB
 
820
""" % (repo.bzrdir.root_transport.base,
 
821
       repo._format.get_format_description(),
 
822
       # poking at _revision_store isn't all that clean, but neither is
 
823
       # having the ui test dependent on the exact overhead of a given store.
 
824
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
772
825
       ), out)
773
826
        self.assertEqual('', err)
774
827
 
 
828
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
 
829
 
775
830
    def test_info_shared_repository_with_trees(self):
776
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
831
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
832
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
777
833
        transport = self.get_transport()
778
834
 
779
835
        # Create shared repository with working trees
780
 
        repo = self.make_repository('repo', shared=True, format=format)
 
836
        repo = self.make_repository('repo', shared=True)
781
837
        repo.set_make_working_trees(True)
782
 
        out, err = self.run_bzr('info -v repo')
 
838
        out, err = self.runbzr('info repo')
783
839
        self.assertEqualDiff(
784
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
785
 
Location:
786
 
  shared repository: repo
 
840
"""Location:
 
841
  shared repository: %s
787
842
 
788
843
Format:
789
844
       control: Meta directory format 1
791
846
 
792
847
Create working tree for new branches inside the repository.
793
848
 
794
 
Repository:
 
849
Revision store:
795
850
         0 revisions
796
 
""" % (format.repository_format.get_format_description(),
 
851
         0 KiB
 
852
""" % (repo.bzrdir.root_transport.base,
 
853
       repo._format.get_format_description(),
797
854
       ), out)
798
855
        self.assertEqual('', err)
799
856
 
800
857
        # Create two branches
801
858
        repo.bzrdir.root_transport.mkdir('branch1')
802
 
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1',
803
 
            format=format)
 
859
        branch1 = repo.bzrdir.create_branch_convenience('repo/branch1')
804
860
        branch2 = branch1.bzrdir.sprout('repo/branch2').open_branch()
805
861
 
806
862
        # Empty first branch
807
 
        out, err = self.run_bzr('info repo/branch1 --verbose')
 
863
        out, err = self.runbzr('info repo/branch1 --verbose')
808
864
        self.assertEqualDiff(
809
 
"""Repository tree (format: knit)
810
 
Location:
811
 
  shared repository: repo
812
 
  repository branch: repo/branch1
 
865
"""Location:
 
866
    shared repository: %s
 
867
  repository checkout: branch1
813
868
 
814
869
Format:
815
870
       control: Meta directory format 1
816
871
  working tree: Working tree format 3
817
 
        branch: %s
 
872
        branch: Branch format 5
818
873
    repository: %s
819
874
 
820
875
In the working tree:
829
884
 
830
885
Branch history:
831
886
         0 revisions
 
887
         0 committers
832
888
 
833
 
Repository:
 
889
Revision store:
834
890
         0 revisions
835
 
""" % (format.get_branch_format().get_format_description(),
836
 
       format.repository_format.get_format_description(),
 
891
         0 KiB
 
892
""" % (repo.bzrdir.root_transport.base,
 
893
       repo._format.get_format_description(),
837
894
       ), out)
838
895
        self.assertEqual('', err)
839
896
 
843
900
        tree1.add('a')
844
901
        tree1.commit('commit one')
845
902
        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')
 
903
        datestring_first = format_date(rev.timestamp, rev.timezone)
 
904
        out, err = self.runbzr('info repo/branch1')
848
905
        self.assertEqualDiff(
849
 
"""Repository tree (format: knit)
850
 
Location:
851
 
  shared repository: repo
852
 
  repository branch: repo/branch1
 
906
"""Location:
 
907
    shared repository: %s
 
908
  repository checkout: branch1
853
909
 
854
910
Format:
855
911
       control: Meta directory format 1
856
912
  working tree: Working tree format 3
857
 
        branch: %s
 
913
        branch: Branch format 5
858
914
    repository: %s
859
915
 
860
916
In the working tree:
873
929
   first revision: %s
874
930
  latest revision: %s
875
931
 
876
 
Repository:
 
932
Revision store:
877
933
         1 revision
878
 
""" % (format.get_branch_format().get_format_description(),
879
 
       format.repository_format.get_format_description(),
 
934
         %d KiB
 
935
""" % (repo.bzrdir.root_transport.base,
 
936
       repo._format.get_format_description(),
880
937
       datestring_first, datestring_first,
 
938
       # poking at _revision_store isn't all that clean, but neither is
 
939
       # having the ui test dependent on the exact overhead of a given store.
 
940
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
881
941
       ), out)
882
942
        self.assertEqual('', err)
883
943
 
884
944
        # Out of date second branch
885
 
        out, err = self.run_bzr('info repo/branch2 --verbose')
 
945
        out, err = self.runbzr('info repo/branch2 --verbose')
886
946
        self.assertEqualDiff(
887
 
"""Repository tree (format: knit)
888
 
Location:
889
 
  shared repository: repo
890
 
  repository branch: repo/branch2
 
947
"""Location:
 
948
    shared repository: %s
 
949
  repository checkout: branch2
891
950
 
892
951
Related branches:
893
 
  parent branch: repo/branch1
 
952
  parent branch: %s
894
953
 
895
954
Format:
896
955
       control: Meta directory format 1
897
956
  working tree: Working tree format 3
898
 
        branch: %s
 
957
        branch: Branch format 5
899
958
    repository: %s
900
959
 
901
960
In the working tree:
910
969
 
911
970
Branch history:
912
971
         0 revisions
 
972
         0 committers
913
973
 
914
 
Repository:
 
974
Revision store:
915
975
         1 revision
916
 
""" % (format.get_branch_format().get_format_description(),
917
 
       format.repository_format.get_format_description(),
 
976
         %d KiB
 
977
""" % (repo.bzrdir.root_transport.base,
 
978
       branch1.bzrdir.root_transport.base,
 
979
       repo._format.get_format_description(),
 
980
       # poking at _revision_store isn't all that clean, but neither is
 
981
       # having the ui test dependent on the exact overhead of a given store.
 
982
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
918
983
       ), out)
919
984
        self.assertEqual('', err)
920
985
 
921
986
        # Update second branch
922
987
        tree2 = branch2.bzrdir.open_workingtree()
923
988
        tree2.pull(branch1)
924
 
        out, err = self.run_bzr('info -v repo/branch2')
 
989
        out, err = self.runbzr('info repo/branch2')
925
990
        self.assertEqualDiff(
926
 
"""Repository tree (format: knit)
927
 
Location:
928
 
  shared repository: repo
929
 
  repository branch: repo/branch2
 
991
"""Location:
 
992
    shared repository: %s
 
993
  repository checkout: branch2
930
994
 
931
995
Related branches:
932
 
  parent branch: repo/branch1
 
996
  parent branch: %s
933
997
 
934
998
Format:
935
999
       control: Meta directory format 1
936
1000
  working tree: Working tree format 3
937
 
        branch: %s
 
1001
        branch: Branch format 5
938
1002
    repository: %s
939
1003
 
940
1004
In the working tree:
953
1017
   first revision: %s
954
1018
  latest revision: %s
955
1019
 
956
 
Repository:
 
1020
Revision store:
957
1021
         1 revision
958
 
""" % (format.get_branch_format().get_format_description(),
959
 
       format.repository_format.get_format_description(),
 
1022
         %d KiB
 
1023
""" % (repo.bzrdir.root_transport.base,
 
1024
       branch1.bzrdir.root_transport.base,
 
1025
       repo._format.get_format_description(),
960
1026
       datestring_first, datestring_first,
 
1027
       # poking at _revision_store isn't all that clean, but neither is
 
1028
       # having the ui test dependent on the exact overhead of a given store.
 
1029
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
961
1030
       ), out)
962
1031
        self.assertEqual('', err)
963
1032
 
964
1033
        # Show info about repository with revisions
965
 
        out, err = self.run_bzr('info -v repo')
 
1034
        out, err = self.runbzr('info repo')
966
1035
        self.assertEqualDiff(
967
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
968
 
Location:
969
 
  shared repository: repo
 
1036
"""Location:
 
1037
  shared repository: %s
970
1038
 
971
1039
Format:
972
1040
       control: Meta directory format 1
974
1042
 
975
1043
Create working tree for new branches inside the repository.
976
1044
 
977
 
Repository:
 
1045
Revision store:
978
1046
         1 revision
979
 
""" % (format.repository_format.get_format_description(),
 
1047
         %d KiB
 
1048
""" % (repo.bzrdir.root_transport.base,
 
1049
       repo._format.get_format_description(),
 
1050
       # poking at _revision_store isn't all that clean, but neither is
 
1051
       # having the ui test dependent on the exact overhead of a given store.
 
1052
       repo._revision_store.total_size(repo.get_transaction())[1] / 1024,
980
1053
       ),
981
1054
       out)
982
1055
        self.assertEqual('', err)
983
1056
 
 
1057
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
 
1058
    
984
1059
    def test_info_shared_repository_with_tree_in_root(self):
985
 
        format = bzrdir.format_registry.make_bzrdir('knit')
 
1060
        old_format = bzrlib.bzrdir.BzrDirFormat.get_default_format()
 
1061
        bzrlib.bzrdir.BzrDirFormat.set_default_format(bzrlib.bzrdir.BzrDirMetaFormat1())
986
1062
        transport = self.get_transport()
987
1063
 
988
1064
        # Create shared repository with working trees
989
 
        repo = self.make_repository('repo', shared=True, format=format)
 
1065
        repo = self.make_repository('repo', shared=True)
990
1066
        repo.set_make_working_trees(True)
991
 
        out, err = self.run_bzr('info -v repo')
 
1067
        out, err = self.runbzr('info repo')
992
1068
        self.assertEqualDiff(
993
 
"""Shared repository with trees (format: dirstate or dirstate-tags or knit)
994
 
Location:
995
 
  shared repository: repo
 
1069
"""Location:
 
1070
  shared repository: %s
996
1071
 
997
1072
Format:
998
1073
       control: Meta directory format 1
1000
1075
 
1001
1076
Create working tree for new branches inside the repository.
1002
1077
 
1003
 
Repository:
 
1078
Revision store:
1004
1079
         0 revisions
1005
 
""" % (format.repository_format.get_format_description(),
 
1080
         0 KiB
 
1081
""" % (repo.bzrdir.root_transport.base,
 
1082
       repo._format.get_format_description(),
1006
1083
       ), out)
1007
1084
        self.assertEqual('', err)
1008
1085
 
1010
1087
        control = repo.bzrdir
1011
1088
        branch = control.create_branch()
1012
1089
        control.create_workingtree()
1013
 
        out, err = self.run_bzr('info -v repo')
 
1090
        out, err = self.runbzr('info repo')
1014
1091
        self.assertEqualDiff(
1015
 
"""Repository tree (format: knit)
1016
 
Location:
1017
 
  shared repository: repo
1018
 
  repository branch: repo
 
1092
"""Location:
 
1093
    shared repository: %s
 
1094
  repository checkout: .
1019
1095
 
1020
1096
Format:
1021
1097
       control: Meta directory format 1
1022
1098
  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)
 
1099
        branch: Branch format 5
 
1100
    repository: %s
 
1101
 
 
1102
In the working tree:
 
1103
         0 unchanged
 
1104
         0 modified
 
1105
         0 added
 
1106
         0 removed
 
1107
         0 renamed
 
1108
         0 unknown
 
1109
         0 ignored
 
1110
         0 versioned subdirectories
 
1111
 
 
1112
Branch history:
 
1113
         0 revisions
 
1114
 
 
1115
Revision store:
 
1116
         0 revisions
 
1117
         0 KiB
 
1118
""" % (repo.bzrdir.root_transport.base,
 
1119
       repo._format.get_format_description(),
 
1120
       ), out)
 
1121
        self.assertEqual('', err)
 
1122
 
 
1123
        bzrlib.bzrdir.BzrDirFormat.set_default_format(old_format)
1212
1124
 
1213
1125
    def test_info_locking(self):
1214
1126
        transport = self.get_transport()
1215
1127
        # Create shared repository with a branch
1216
1128
        repo = self.make_repository('repo', shared=True,
1217
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1129
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1218
1130
        repo.set_make_working_trees(False)
1219
1131
        repo.bzrdir.root_transport.mkdir('branch')
1220
1132
        repo_branch = repo.bzrdir.create_branch_convenience('repo/branch',
1221
 
                                    format=bzrdir.BzrDirMetaFormat1())
 
1133
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1222
1134
        # Do a heavy checkout
1223
1135
        transport.mkdir('tree')
1224
1136
        transport.mkdir('tree/checkout')
1225
 
        co_branch = bzrdir.BzrDir.create_branch_convenience('tree/checkout',
1226
 
            format=bzrdir.BzrDirMetaFormat1())
 
1137
        co_branch = bzrlib.bzrdir.BzrDir.create_branch_convenience('tree/checkout',
 
1138
                                    format=bzrlib.bzrdir.BzrDirMetaFormat1())
1227
1139
        co_branch.bind(repo_branch)
1228
1140
        # Do a light checkout of the heavy one
1229
1141
        transport.mkdir('tree/lightcheckout')
1230
 
        lco_dir = bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
1231
 
        branch.BranchReferenceFormat().initialize(lco_dir,
1232
 
            target_branch=co_branch)
 
1142
        lco_dir = bzrlib.bzrdir.BzrDirMetaFormat1().initialize('tree/lightcheckout')
 
1143
        bzrlib.branch.BranchReferenceFormat().initialize(lco_dir, co_branch)
1233
1144
        lco_dir.create_workingtree()
1234
1145
        lco_tree = lco_dir.open_workingtree()
1235
1146
 
1237
1148
        # W B R
1238
1149
 
1239
1150
        # U U U
1240
 
        self.assertCheckoutStatusOutput('-v tree/lightcheckout', lco_tree,
1241
 
                                        repo_branch=repo_branch,
1242
 
                                        verbose=True, light_checkout=True)
 
1151
        out, err = self.runbzr('info tree/lightcheckout')
 
1152
        self.assertEqualDiff(
 
1153
"""Location:
 
1154
  light checkout root: %s
 
1155
   checkout of branch: %s
 
1156
 
 
1157
Format:
 
1158
       control: Meta directory format 1
 
1159
  working tree: Working tree format 3
 
1160
        branch: Branch format 5
 
1161
    repository: %s
 
1162
 
 
1163
In the working tree:
 
1164
         0 unchanged
 
1165
         0 modified
 
1166
         0 added
 
1167
         0 removed
 
1168
         0 renamed
 
1169
         0 unknown
 
1170
         0 ignored
 
1171
         0 versioned subdirectories
 
1172
 
 
1173
Branch history:
 
1174
         0 revisions
 
1175
 
 
1176
Revision store:
 
1177
         0 revisions
 
1178
         0 KiB
 
1179
""" % (lco_tree.bzrdir.root_transport.base,
 
1180
       lco_tree.branch.bzrdir.root_transport.base,
 
1181
       lco_tree.branch.repository._format.get_format_description(),
 
1182
       ), out)
 
1183
        self.assertEqual('', err)
1243
1184
        # U U L
1244
1185
        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()
 
1186
        out, err = self.runbzr('info tree/lightcheckout')
 
1187
        self.assertEqualDiff(
 
1188
"""Location:
 
1189
  light checkout root: %s
 
1190
   checkout of branch: %s
 
1191
 
 
1192
Format:
 
1193
       control: Meta directory format 1
 
1194
  working tree: Working tree format 3
 
1195
        branch: Branch format 5
 
1196
    repository: %s
 
1197
 
 
1198
Lock status:
 
1199
  working tree: unlocked
 
1200
        branch: unlocked
 
1201
    repository: locked
 
1202
 
 
1203
In the working tree:
 
1204
         0 unchanged
 
1205
         0 modified
 
1206
         0 added
 
1207
         0 removed
 
1208
         0 renamed
 
1209
         0 unknown
 
1210
         0 ignored
 
1211
         0 versioned subdirectories
 
1212
 
 
1213
Branch history:
 
1214
         0 revisions
 
1215
 
 
1216
Revision store:
 
1217
         0 revisions
 
1218
         0 KiB
 
1219
""" % (lco_tree.bzrdir.root_transport.base,
 
1220
       lco_tree.branch.bzrdir.root_transport.base,
 
1221
       lco_tree.branch.repository._format.get_format_description(),
 
1222
       ), out)
 
1223
        self.assertEqual('', err)
 
1224
        lco_tree.branch.repository.unlock()
1251
1225
        # U L L
1252
1226
        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()
 
1227
        out, err = self.runbzr('info tree/lightcheckout')
 
1228
        self.assertEqualDiff(
 
1229
"""Location:
 
1230
  light checkout root: %s
 
1231
   checkout of branch: %s
 
1232
 
 
1233
Format:
 
1234
       control: Meta directory format 1
 
1235
  working tree: Working tree format 3
 
1236
        branch: Branch format 5
 
1237
    repository: %s
 
1238
 
 
1239
Lock status:
 
1240
  working tree: unlocked
 
1241
        branch: locked
 
1242
    repository: locked
 
1243
 
 
1244
In the working tree:
 
1245
         0 unchanged
 
1246
         0 modified
 
1247
         0 added
 
1248
         0 removed
 
1249
         0 renamed
 
1250
         0 unknown
 
1251
         0 ignored
 
1252
         0 versioned subdirectories
 
1253
 
 
1254
Branch history:
 
1255
         0 revisions
 
1256
 
 
1257
Revision store:
 
1258
         0 revisions
 
1259
         0 KiB
 
1260
""" % (lco_tree.bzrdir.root_transport.base,
 
1261
       lco_tree.branch.bzrdir.root_transport.base,
 
1262
       lco_tree.branch.repository._format.get_format_description(),
 
1263
       ), out)
 
1264
        self.assertEqual('', err)
 
1265
        lco_tree.branch.unlock()
1262
1266
        # L L L
1263
1267
        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()
 
1268
        out, err = self.runbzr('info tree/lightcheckout')
 
1269
        self.assertEqualDiff(
 
1270
"""Location:
 
1271
  light checkout root: %s
 
1272
   checkout of branch: %s
 
1273
 
 
1274
Format:
 
1275
       control: Meta directory format 1
 
1276
  working tree: Working tree format 3
 
1277
        branch: Branch format 5
 
1278
    repository: %s
 
1279
 
 
1280
Lock status:
 
1281
  working tree: locked
 
1282
        branch: locked
 
1283
    repository: locked
 
1284
 
 
1285
In the working tree:
 
1286
         0 unchanged
 
1287
         0 modified
 
1288
         0 added
 
1289
         0 removed
 
1290
         0 renamed
 
1291
         0 unknown
 
1292
         0 ignored
 
1293
         0 versioned subdirectories
 
1294
 
 
1295
Branch history:
 
1296
         0 revisions
 
1297
 
 
1298
Revision store:
 
1299
         0 revisions
 
1300
         0 KiB
 
1301
""" % (lco_tree.bzrdir.root_transport.base,
 
1302
       lco_tree.branch.bzrdir.root_transport.base,
 
1303
       lco_tree.branch.repository._format.get_format_description(),
 
1304
       ), out)
 
1305
        self.assertEqual('', err)
 
1306
        lco_tree.unlock()
1273
1307
        # L L U
1274
1308
        lco_tree.lock_write()
1275
1309
        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()
 
1310
        out, err = self.runbzr('info tree/lightcheckout')
 
1311
        self.assertEqualDiff(
 
1312
"""Location:
 
1313
  light checkout root: %s
 
1314
   checkout of branch: %s
 
1315
 
 
1316
Format:
 
1317
       control: Meta directory format 1
 
1318
  working tree: Working tree format 3
 
1319
        branch: Branch format 5
 
1320
    repository: %s
 
1321
 
 
1322
Lock status:
 
1323
  working tree: locked
 
1324
        branch: locked
 
1325
    repository: unlocked
 
1326
 
 
1327
In the working tree:
 
1328
         0 unchanged
 
1329
         0 modified
 
1330
         0 added
 
1331
         0 removed
 
1332
         0 renamed
 
1333
         0 unknown
 
1334
         0 ignored
 
1335
         0 versioned subdirectories
 
1336
 
 
1337
Branch history:
 
1338
         0 revisions
 
1339
 
 
1340
Revision store:
 
1341
         0 revisions
 
1342
         0 KiB
 
1343
""" % (lco_tree.bzrdir.root_transport.base,
 
1344
       lco_tree.branch.bzrdir.root_transport.base,
 
1345
       lco_tree.branch.repository._format.get_format_description(),
 
1346
       ), out)
 
1347
        self.assertEqual('', err)
 
1348
        lco_tree.branch.repository.lock_write()
 
1349
        lco_tree.unlock()
1285
1350
        # L U U
1286
1351
        lco_tree.lock_write()
1287
1352
        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()
 
1353
        out, err = self.runbzr('info tree/lightcheckout')
 
1354
        self.assertEqualDiff(
 
1355
"""Location:
 
1356
  light checkout root: %s
 
1357
   checkout of branch: %s
 
1358
 
 
1359
Format:
 
1360
       control: Meta directory format 1
 
1361
  working tree: Working tree format 3
 
1362
        branch: Branch format 5
 
1363
    repository: %s
 
1364
 
 
1365
Lock status:
 
1366
  working tree: locked
 
1367
        branch: unlocked
 
1368
    repository: unlocked
 
1369
 
 
1370
In the working tree:
 
1371
         0 unchanged
 
1372
         0 modified
 
1373
         0 added
 
1374
         0 removed
 
1375
         0 renamed
 
1376
         0 unknown
 
1377
         0 ignored
 
1378
         0 versioned subdirectories
 
1379
 
 
1380
Branch history:
 
1381
         0 revisions
 
1382
 
 
1383
Revision store:
 
1384
         0 revisions
 
1385
         0 KiB
 
1386
""" % (lco_tree.bzrdir.root_transport.base,
 
1387
       lco_tree.branch.bzrdir.root_transport.base,
 
1388
       lco_tree.branch.repository._format.get_format_description(),
 
1389
       ), out)
 
1390
        self.assertEqual('', err)
 
1391
        lco_tree.branch.lock_write()
 
1392
        lco_tree.unlock()
1296
1393
        # L U L
1297
1394
        lco_tree.lock_write()
1298
1395
        lco_tree.branch.unlock()
1299
1396
        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()
 
1397
        out, err = self.runbzr('info tree/lightcheckout')
 
1398
        self.assertEqualDiff(
 
1399
"""Location:
 
1400
  light checkout root: %s
 
1401
   checkout of branch: %s
 
1402
 
 
1403
Format:
 
1404
       control: Meta directory format 1
 
1405
  working tree: Working tree format 3
 
1406
        branch: Branch format 5
 
1407
    repository: %s
 
1408
 
 
1409
Lock status:
 
1410
  working tree: locked
 
1411
        branch: unlocked
 
1412
    repository: locked
 
1413
 
 
1414
In the working tree:
 
1415
         0 unchanged
 
1416
         0 modified
 
1417
         0 added
 
1418
         0 removed
 
1419
         0 renamed
 
1420
         0 unknown
 
1421
         0 ignored
 
1422
         0 versioned subdirectories
 
1423
 
 
1424
Branch history:
 
1425
         0 revisions
 
1426
 
 
1427
Revision store:
 
1428
         0 revisions
 
1429
         0 KiB
 
1430
""" % (lco_tree.bzrdir.root_transport.base,
 
1431
       lco_tree.branch.bzrdir.root_transport.base,
 
1432
       lco_tree.branch.repository._format.get_format_description(),
 
1433
       ), out)
 
1434
        self.assertEqual('', err)
 
1435
        lco_tree.branch.repository.unlock()
 
1436
        lco_tree.branch.lock_write()
 
1437
        lco_tree.unlock()
1310
1438
        # U L U
1311
1439
        lco_tree.branch.lock_write()
1312
1440
        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.')
 
1441
        out, err = self.runbzr('info tree/lightcheckout')
 
1442
        self.assertEqualDiff(
 
1443
"""Location:
 
1444
  light checkout root: %s
 
1445
   checkout of branch: %s
 
1446
 
 
1447
Format:
 
1448
       control: Meta directory format 1
 
1449
  working tree: Working tree format 3
 
1450
        branch: Branch format 5
 
1451
    repository: %s
 
1452
 
 
1453
Lock status:
 
1454
  working tree: unlocked
 
1455
        branch: locked
 
1456
    repository: unlocked
 
1457
 
 
1458
In the working tree:
 
1459
         0 unchanged
 
1460
         0 modified
 
1461
         0 added
 
1462
         0 removed
 
1463
         0 renamed
 
1464
         0 unknown
 
1465
         0 ignored
 
1466
         0 versioned subdirectories
 
1467
 
 
1468
Branch history:
 
1469
         0 revisions
 
1470
 
 
1471
Revision store:
 
1472
         0 revisions
 
1473
         0 KiB
 
1474
""" % (lco_tree.bzrdir.root_transport.base,
 
1475
       lco_tree.branch.bzrdir.root_transport.base,
 
1476
       lco_tree.branch.repository._format.get_format_description(),
 
1477
       ), out)
 
1478
        self.assertEqual('', err)
 
1479
        lco_tree.branch.repository.lock_write()
 
1480
        lco_tree.branch.unlock()
1325
1481
 
1326
1482
    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
1483
        tree = self.make_branch_and_tree('branch',
1336
 
                                         format=bzrdir.BzrDirFormat6())
 
1484
                                         format=bzrlib.bzrdir.BzrDirFormat6())
1337
1485
 
1338
1486
        # Test all permutations of locking the working tree, branch and repository
1339
1487
        # XXX: Well not yet, as we can't query oslocks yet. Currently, it's
1342
1490
        # W B R
1343
1491
 
1344
1492
        # U U U
1345
 
        out, err = self.run_bzr('info -v branch')
 
1493
        out, err = self.runbzr('info branch')
1346
1494
        self.assertEqualDiff(
1347
 
"""Standalone tree (format: weave)
1348
 
Location:
 
1495
"""Location:
1349
1496
  branch root: %s
1350
1497
 
1351
1498
Format:
1367
1514
Branch history:
1368
1515
         0 revisions
1369
1516
 
1370
 
Repository:
 
1517
Revision store:
1371
1518
         0 revisions
1372
 
""" % ('branch', tree.branch.repository._format.get_format_description(),
 
1519
         0 KiB
 
1520
""" % (tree.bzrdir.root_transport.base,
 
1521
       tree.branch.repository._format.get_format_description(),
1373
1522
       ), out)
1374
1523
        self.assertEqual('', err)
1375
1524
        # L L L
1376
1525
        tree.lock_write()
1377
 
        out, err = self.run_bzr('info -v branch')
 
1526
        out, err = self.runbzr('info branch')
1378
1527
        self.assertEqualDiff(
1379
 
"""Standalone tree (format: weave)
1380
 
Location:
 
1528
"""Location:
1381
1529
  branch root: %s
1382
1530
 
1383
1531
Format:
1399
1547
Branch history:
1400
1548
         0 revisions
1401
1549
 
1402
 
Repository:
 
1550
Revision store:
1403
1551
         0 revisions
1404
 
""" % ('branch', tree.branch.repository._format.get_format_description(),
 
1552
         0 KiB
 
1553
""" % (tree.bzrdir.root_transport.base,
 
1554
       tree.branch.repository._format.get_format_description(),
1405
1555
       ), out)
1406
1556
        self.assertEqual('', err)
1407
1557
        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)