/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-08 04:39:50 UTC
  • mto: This revision was merged to the branch mainline in revision 1707.
  • Revision ID: mbp@sourcefrog.net-20060508043950-bb61b1e5ea33c349
Fix time-dependency in LockDir tests -- allow more margin for error in time to detect lock contention

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