/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: John Arbash Meinel
  • Date: 2006-04-25 15:05:42 UTC
  • mfrom: (1185.85.85 bzr-encoding)
  • mto: This revision was merged to the branch mainline in revision 1752.
  • Revision ID: john@arbash-meinel.com-20060425150542-c7b518dca9928691
[merge] the old bzr-encoding changes, reparenting them on bzr.dev

Show diffs side-by-side

added added

removed removed

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