~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: John Arbash Meinel
  • Date: 2007-07-12 18:10:59 UTC
  • mto: This revision was merged to the branch mainline in revision 2643.
  • Revision ID: john@arbash-meinel.com-20070712181059-xnomv3tzzsb2hpx5
Add NEWS entries for performance improvements.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
2
 
#
 
1
# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 
2
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# 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
 
 
17
 
from __future__ import absolute_import
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
16
 
19
17
__all__ = ['show_bzrdir_info']
20
18
 
21
 
from cStringIO import StringIO
 
19
import os
22
20
import time
23
21
import sys
24
22
 
25
23
from bzrlib import (
26
24
    bzrdir,
27
 
    controldir,
 
25
    diff,
28
26
    errors,
29
 
    hooks as _mod_hooks,
30
27
    osutils,
31
28
    urlutils,
32
29
    )
33
30
from bzrlib.errors import (NoWorkingTree, NotBranchError,
34
31
                           NoRepositoryPresent, NotLocalUrl)
35
32
from bzrlib.missing import find_unmerged
 
33
from bzrlib.symbol_versioning import (deprecated_function,
 
34
        zero_eight, zero_eighteen)
36
35
 
37
36
 
38
37
def plural(n, base='', pl=None):
79
78
        return ["  %*s: %s\n" % (max_len, l, u) for l, u in self.locs ]
80
79
 
81
80
 
82
 
def gather_location_info(repository=None, branch=None, working=None,
83
 
        control=None):
 
81
def gather_location_info(repository, branch=None, working=None):
84
82
    locs = {}
 
83
    repository_path = repository.bzrdir.root_transport.base
85
84
    if branch is not None:
86
 
        branch_path = branch.user_url
 
85
        branch_path = branch.bzrdir.root_transport.base
87
86
        master_path = branch.get_bound_location()
88
87
        if master_path is None:
89
88
            master_path = branch_path
90
89
    else:
91
90
        branch_path = None
92
91
        master_path = None
93
 
        try:
94
 
            if control is not None and control.get_branch_reference():
95
 
                locs['checkout of branch'] = control.get_branch_reference()
96
 
        except NotBranchError:
97
 
            pass
98
92
    if working:
99
 
        working_path = working.user_url
 
93
        working_path = working.bzrdir.root_transport.base
100
94
        if working_path != branch_path:
101
95
            locs['light checkout root'] = working_path
102
96
        if master_path != branch_path:
113
107
            locs['branch root'] = branch_path
114
108
    else:
115
109
        working_path = None
116
 
        if repository is not None and repository.is_shared():
 
110
        if repository.is_shared():
117
111
            # lightweight checkout of branch in shared repository
118
112
            if branch_path is not None:
119
113
                locs['repository branch'] = branch_path
120
114
        elif branch_path is not None:
121
115
            # standalone
122
116
            locs['branch root'] = branch_path
123
 
        elif repository is not None:
124
 
            locs['repository'] = repository.user_url
125
 
        elif control is not None:
126
 
            locs['control directory'] = control.user_url
 
117
            if master_path != branch_path:
 
118
                locs['bound to branch'] = master_path
127
119
        else:
128
 
            # Really, at least a control directory should be
129
 
            # passed in for this method to be useful.
130
 
            pass
131
 
        if master_path != branch_path:
132
 
            locs['bound to branch'] = master_path
133
 
    if repository is not None and repository.is_shared():
 
120
            locs['repository'] = repository_path
 
121
    if repository.is_shared():
134
122
        # lightweight checkout of branch in shared repository
135
 
        locs['shared repository'] = repository.user_url
136
 
    order = ['control directory', 'light checkout root',
137
 
             'repository checkout root', 'checkout root',
138
 
             'checkout of branch', 'shared repository',
 
123
        locs['shared repository'] = repository_path
 
124
    order = ['light checkout root', 'repository checkout root',
 
125
             'checkout root', 'checkout of branch', 'shared repository',
139
126
             'repository', 'repository branch', 'branch root',
140
127
             'bound to branch']
141
128
    return [(n, locs[n]) for n in order if n in locs]
142
129
 
143
130
 
144
 
def _show_location_info(locs, outfile):
 
131
def _show_location_info(locs):
145
132
    """Show known locations for working, branch and repository."""
146
 
    outfile.write('Location:\n')
147
 
    path_list = LocationList(osutils.getcwd())
 
133
    print 'Location:'
 
134
    path_list = LocationList(os.getcwd())
148
135
    for name, loc in locs:
149
136
        path_list.add_url(name, loc)
150
 
    outfile.writelines(path_list.get_lines())
151
 
 
 
137
    sys.stdout.writelines(path_list.get_lines())
152
138
 
153
139
def _gather_related_branches(branch):
154
 
    locs = LocationList(osutils.getcwd())
 
140
    locs = LocationList(os.getcwd())
155
141
    locs.add_url('public branch', branch.get_public_branch())
156
142
    locs.add_url('push branch', branch.get_push_location())
157
143
    locs.add_url('parent branch', branch.get_parent())
158
144
    locs.add_url('submit branch', branch.get_submit_branch())
159
 
    try:
160
 
        locs.add_url('stacked on', branch.get_stacked_on_url())
161
 
    except (errors.UnstackableBranchFormat, errors.UnstackableRepositoryFormat,
162
 
        errors.NotStacked):
163
 
        pass
164
145
    return locs
165
146
 
166
 
 
167
147
def _show_related_info(branch, outfile):
168
148
    """Show parent and push location of branch."""
169
149
    locs = _gather_related_branches(branch)
170
150
    if len(locs.locs) > 0:
171
 
        outfile.write('\n')
172
 
        outfile.write('Related branches:\n')
 
151
        print >> outfile
 
152
        print >> outfile, 'Related branches:'
173
153
        outfile.writelines(locs.get_lines())
174
154
 
175
155
 
176
 
def _show_control_dir_info(control, outfile):
177
 
    """Show control dir information."""
178
 
    if control._format.colocated_branches:
179
 
        outfile.write('\n')
180
 
        outfile.write('Control directory:\n')
181
 
        outfile.write('         %d branches\n' % len(control.list_branches()))
182
 
 
183
 
 
184
 
def _show_format_info(control=None, repository=None, branch=None,
185
 
                      working=None, outfile=None):
 
156
def _show_format_info(control=None, repository=None, branch=None, working=None):
186
157
    """Show known formats for control, working, branch and repository."""
187
 
    outfile.write('\n')
188
 
    outfile.write('Format:\n')
 
158
    print
 
159
    print 'Format:'
189
160
    if control:
190
 
        outfile.write('       control: %s\n' %
191
 
            control._format.get_format_description())
 
161
        print '       control: %s' % control._format.get_format_description()
192
162
    if working:
193
 
        outfile.write('  working tree: %s\n' %
194
 
            working._format.get_format_description())
 
163
        print '  working tree: %s' % working._format.get_format_description()
195
164
    if branch:
196
 
        outfile.write('        branch: %s\n' %
197
 
            branch._format.get_format_description())
 
165
        print '        branch: %s' % branch._format.get_format_description()
198
166
    if repository:
199
 
        outfile.write('    repository: %s\n' %
200
 
            repository._format.get_format_description())
201
 
 
202
 
 
203
 
def _show_locking_info(repository=None, branch=None, working=None,
204
 
        outfile=None):
 
167
        print '    repository: %s' % repository._format.get_format_description()
 
168
 
 
169
 
 
170
def _show_locking_info(repository, branch=None, working=None):
205
171
    """Show locking status of working, branch and repository."""
206
 
    if (repository and repository.get_physical_lock_status() or
 
172
    if (repository.get_physical_lock_status() or
207
173
        (branch and branch.get_physical_lock_status()) or
208
174
        (working and working.get_physical_lock_status())):
209
 
        outfile.write('\n')
210
 
        outfile.write('Lock status:\n')
 
175
        print
 
176
        print 'Lock status:'
211
177
        if working:
212
178
            if working.get_physical_lock_status():
213
179
                status = 'locked'
214
180
            else:
215
181
                status = 'unlocked'
216
 
            outfile.write('  working tree: %s\n' % status)
 
182
            print '  working tree: %s' % status
217
183
        if branch:
218
184
            if branch.get_physical_lock_status():
219
185
                status = 'locked'
220
186
            else:
221
187
                status = 'unlocked'
222
 
            outfile.write('        branch: %s\n' % status)
 
188
            print '        branch: %s' % status
223
189
        if repository:
224
190
            if repository.get_physical_lock_status():
225
191
                status = 'locked'
226
192
            else:
227
193
                status = 'unlocked'
228
 
            outfile.write('    repository: %s\n' % status)
229
 
 
230
 
 
231
 
def _show_missing_revisions_branch(branch, outfile):
 
194
            print '    repository: %s' % status
 
195
 
 
196
 
 
197
def _show_missing_revisions_branch(branch):
232
198
    """Show missing master revisions in branch."""
233
199
    # Try with inaccessible branch ?
234
200
    master = branch.get_master_branch()
235
201
    if master:
236
202
        local_extra, remote_extra = find_unmerged(branch, master)
237
203
        if remote_extra:
238
 
            outfile.write('\n')
239
 
            outfile.write(('Branch is out of date: missing %d '
240
 
                'revision%s.\n') % (len(remote_extra),
241
 
                plural(len(remote_extra))))
242
 
 
243
 
 
244
 
def _show_missing_revisions_working(working, outfile):
 
204
            print
 
205
            print 'Branch is out of date: missing %d revision%s.' % (
 
206
                len(remote_extra), plural(len(remote_extra)))
 
207
 
 
208
 
 
209
def _show_missing_revisions_working(working):
245
210
    """Show missing revisions in working tree."""
246
211
    branch = working.branch
247
212
    basis = working.basis_tree()
248
 
    try:
249
 
        branch_revno, branch_last_revision = branch.last_revision_info()
250
 
    except errors.UnsupportedOperation:
251
 
        return
 
213
    work_inv = working.inventory
 
214
    branch_revno, branch_last_revision = branch.last_revision_info()
252
215
    try:
253
216
        tree_last_id = working.get_parent_ids()[0]
254
217
    except IndexError:
257
220
    if branch_revno and tree_last_id != branch_last_revision:
258
221
        tree_last_revno = branch.revision_id_to_revno(tree_last_id)
259
222
        missing_count = branch_revno - tree_last_revno
260
 
        outfile.write('\n')
261
 
        outfile.write(('Working tree is out of date: missing %d '
262
 
            'revision%s.\n') % (missing_count, plural(missing_count)))
263
 
 
264
 
 
265
 
def _show_working_stats(working, outfile):
 
223
        print
 
224
        print 'Working tree is out of date: missing %d revision%s.' % (
 
225
            missing_count, plural(missing_count))
 
226
 
 
227
 
 
228
def _show_working_stats(working):
266
229
    """Show statistics about a working tree."""
267
230
    basis = working.basis_tree()
 
231
    work_inv = working.inventory
268
232
    delta = working.changes_from(basis, want_unchanged=True)
269
233
 
270
 
    outfile.write('\n')
271
 
    outfile.write('In the working tree:\n')
272
 
    outfile.write('  %8s unchanged\n' % len(delta.unchanged))
273
 
    outfile.write('  %8d modified\n' % len(delta.modified))
274
 
    outfile.write('  %8d added\n' % len(delta.added))
275
 
    outfile.write('  %8d removed\n' % len(delta.removed))
276
 
    outfile.write('  %8d renamed\n' % len(delta.renamed))
 
234
    print
 
235
    print 'In the working tree:'
 
236
    print '  %8s unchanged' % len(delta.unchanged)
 
237
    print '  %8d modified' % len(delta.modified)
 
238
    print '  %8d added' % len(delta.added)
 
239
    print '  %8d removed' % len(delta.removed)
 
240
    print '  %8d renamed' % len(delta.renamed)
277
241
 
278
242
    ignore_cnt = unknown_cnt = 0
279
243
    for path in working.extras():
281
245
            ignore_cnt += 1
282
246
        else:
283
247
            unknown_cnt += 1
284
 
    outfile.write('  %8d unknown\n' % unknown_cnt)
285
 
    outfile.write('  %8d ignored\n' % ignore_cnt)
 
248
    print '  %8d unknown' % unknown_cnt
 
249
    print '  %8d ignored' % ignore_cnt
286
250
 
287
251
    dir_cnt = 0
288
 
    root_id = working.get_root_id()
289
 
    for path, entry in working.iter_entries_by_dir():
290
 
        if entry.kind == 'directory' and entry.file_id != root_id:
 
252
    for file_id in work_inv:
 
253
        if (work_inv.get_file_kind(file_id) == 'directory' and 
 
254
            not work_inv.is_root(file_id)):
291
255
            dir_cnt += 1
292
 
    outfile.write('  %8d versioned %s\n' % (dir_cnt,
293
 
        plural(dir_cnt, 'subdirectory', 'subdirectories')))
294
 
 
295
 
 
296
 
def _show_branch_stats(branch, verbose, outfile):
 
256
    print '  %8d versioned %s' \
 
257
          % (dir_cnt,
 
258
             plural(dir_cnt, 'subdirectory', 'subdirectories'))
 
259
 
 
260
 
 
261
def _show_branch_stats(branch, verbose):
297
262
    """Show statistics about a branch."""
298
 
    try:
299
 
        revno, head = branch.last_revision_info()
300
 
    except errors.UnsupportedOperation:
301
 
        return {}
302
 
    outfile.write('\n')
303
 
    outfile.write('Branch history:\n')
304
 
    outfile.write('  %8d revision%s\n' % (revno, plural(revno)))
 
263
    revno, head = branch.last_revision_info()
 
264
    print
 
265
    print 'Branch history:'
 
266
    print '  %8d revision%s' % (revno, plural(revno))
305
267
    stats = branch.repository.gather_stats(head, committers=verbose)
306
268
    if verbose:
307
269
        committers = stats['committers']
308
 
        outfile.write('  %8d committer%s\n' % (committers,
309
 
            plural(committers)))
 
270
        print '  %8d committer%s' % (committers, plural(committers))
310
271
    if revno:
311
272
        timestamp, timezone = stats['firstrev']
312
273
        age = int((time.time() - timestamp) / 3600 / 24)
313
 
        outfile.write('  %8d day%s old\n' % (age, plural(age)))
314
 
        outfile.write('   first revision: %s\n' %
315
 
            osutils.format_date(timestamp, timezone))
 
274
        print '  %8d day%s old' % (age, plural(age))
 
275
        print '   first revision: %s' % osutils.format_date(timestamp,
 
276
            timezone)
316
277
        timestamp, timezone = stats['latestrev']
317
 
        outfile.write('  latest revision: %s\n' %
318
 
            osutils.format_date(timestamp, timezone))
 
278
        print '  latest revision: %s' % osutils.format_date(timestamp,
 
279
            timezone)
319
280
    return stats
320
281
 
321
282
 
322
 
def _show_repository_info(repository, outfile):
 
283
def _show_repository_info(repository):
323
284
    """Show settings of a repository."""
324
285
    if repository.make_working_trees():
325
 
        outfile.write('\n')
326
 
        outfile.write('Create working tree for new branches inside '
327
 
            'the repository.\n')
328
 
 
329
 
 
330
 
def _show_repository_stats(repository, stats, outfile):
 
286
        print
 
287
        print 'Create working tree for new branches inside the repository.'
 
288
 
 
289
 
 
290
def _show_repository_stats(stats):
331
291
    """Show statistics about a repository."""
332
 
    f = StringIO()
 
292
    if 'revisions' in stats or 'size' in stats:
 
293
        print
 
294
        print 'Repository:'
333
295
    if 'revisions' in stats:
334
296
        revisions = stats['revisions']
335
 
        f.write('  %8d revision%s\n' % (revisions, plural(revisions)))
 
297
        print '  %8d revision%s' % (revisions, plural(revisions))
336
298
    if 'size' in stats:
337
 
        f.write('  %8d KiB\n' % (stats['size']/1024))
338
 
    for hook in hooks['repository']:
339
 
        hook(repository, stats, f)
340
 
    if f.getvalue() != "":
341
 
        outfile.write('\n')
342
 
        outfile.write('Repository:\n')
343
 
        outfile.write(f.getvalue())
344
 
 
345
 
 
346
 
def show_bzrdir_info(a_bzrdir, verbose=False, outfile=None):
 
299
        print '  %8d KiB' % (stats['size']/1024)
 
300
 
 
301
def show_bzrdir_info(a_bzrdir, verbose=False):
347
302
    """Output to stdout the 'info' for a_bzrdir."""
348
 
    if outfile is None:
349
 
        outfile = sys.stdout
350
303
    try:
351
304
        tree = a_bzrdir.open_workingtree(
352
305
            recommend_upgrade=False)
353
 
    except (NoWorkingTree, NotLocalUrl, NotBranchError):
 
306
    except (NoWorkingTree, NotLocalUrl):
354
307
        tree = None
355
308
        try:
356
 
            branch = a_bzrdir.open_branch(name="")
 
309
            branch = a_bzrdir.open_branch()
357
310
        except NotBranchError:
358
311
            branch = None
359
312
            try:
360
313
                repository = a_bzrdir.open_repository()
361
314
            except NoRepositoryPresent:
362
 
                lockable = None
363
 
                repository = None
 
315
                # Return silently; cmd_info already returned NotBranchError
 
316
                # if no bzrdir could be opened.
 
317
                return
364
318
            else:
365
319
                lockable = repository
366
320
        else:
371
325
        repository = branch.repository
372
326
        lockable = tree
373
327
 
374
 
    if lockable is not None:
375
 
        lockable.lock_read()
 
328
    lockable.lock_read()
376
329
    try:
377
 
        show_component_info(a_bzrdir, repository, branch, tree, verbose,
378
 
                            outfile)
 
330
        show_component_info(a_bzrdir, repository, branch, tree, verbose)
379
331
    finally:
380
 
        if lockable is not None:
381
 
            lockable.unlock()
 
332
        lockable.unlock()
382
333
 
383
334
 
384
335
def show_component_info(control, repository, branch=None, working=None,
385
 
    verbose=1, outfile=None):
 
336
    verbose=1):
386
337
    """Write info about all bzrdir components to stdout"""
387
 
    if outfile is None:
388
 
        outfile = sys.stdout
389
338
    if verbose is False:
390
339
        verbose = 1
391
340
    if verbose is True:
392
341
        verbose = 2
393
 
    layout = describe_layout(repository, branch, working, control)
 
342
    layout = describe_layout(repository, branch, working)
394
343
    format = describe_format(control, repository, branch, working)
395
 
    outfile.write("%s (format: %s)\n" % (layout, format))
396
 
    _show_location_info(
397
 
        gather_location_info(control=control, repository=repository,
398
 
            branch=branch, working=working),
399
 
        outfile)
 
344
    print "%s (format: %s)" % (layout, format)
 
345
    _show_location_info(gather_location_info(repository, branch, working))
400
346
    if branch is not None:
401
 
        _show_related_info(branch, outfile)
 
347
        _show_related_info(branch, sys.stdout)
402
348
    if verbose == 0:
403
349
        return
404
 
    _show_format_info(control, repository, branch, working, outfile)
405
 
    _show_locking_info(repository, branch, working, outfile)
406
 
    _show_control_dir_info(control, outfile)
 
350
    _show_format_info(control, repository, branch, working)
 
351
    _show_locking_info(repository, branch, working)
407
352
    if branch is not None:
408
 
        _show_missing_revisions_branch(branch, outfile)
 
353
        _show_missing_revisions_branch(branch)
409
354
    if working is not None:
410
 
        _show_missing_revisions_working(working, outfile)
411
 
        _show_working_stats(working, outfile)
 
355
        _show_missing_revisions_working(working)
 
356
        _show_working_stats(working)
412
357
    elif branch is not None:
413
 
        _show_missing_revisions_branch(branch, outfile)
 
358
        _show_missing_revisions_branch(branch)
414
359
    if branch is not None:
415
 
        show_committers = verbose >= 2
416
 
        stats = _show_branch_stats(branch, show_committers, outfile)
417
 
    elif repository is not None:
 
360
        stats = _show_branch_stats(branch, verbose==2)
 
361
    else:
418
362
        stats = repository.gather_stats()
419
 
    if branch is None and working is None and repository is not None:
420
 
        _show_repository_info(repository, outfile)
421
 
    if repository is not None:
422
 
        _show_repository_stats(repository, stats, outfile)
423
 
 
424
 
 
425
 
def describe_layout(repository=None, branch=None, tree=None, control=None):
 
363
    if branch is None and working is None:
 
364
        _show_repository_info(repository)
 
365
    _show_repository_stats(stats)
 
366
 
 
367
 
 
368
def describe_layout(repository=None, branch=None, tree=None):
426
369
    """Convert a control directory layout into a user-understandable term
427
370
 
428
371
    Common outputs include "Standalone tree", "Repository branch" and
429
372
    "Checkout".  Uncommon outputs include "Unshared repository with trees"
430
373
    and "Empty control directory"
431
374
    """
432
 
    if branch is None and control is not None:
433
 
        try:
434
 
            branch_reference = control.get_branch_reference()
435
 
        except NotBranchError:
436
 
            pass
437
 
        else:
438
 
            if branch_reference is not None:
439
 
                return "Dangling branch reference"
440
375
    if repository is None:
441
376
        return 'Empty control directory'
442
377
    if branch is None and tree is None:
444
379
            phrase = 'Shared repository'
445
380
        else:
446
381
            phrase = 'Unshared repository'
447
 
        extra = []
448
382
        if repository.make_working_trees():
449
 
            extra.append('trees')
450
 
        if len(control.get_branches()) > 0:
451
 
            extra.append('colocated branches')
452
 
        if extra:
453
 
            phrase += ' with ' + " and ".join(extra)
 
383
            phrase += ' with trees'
454
384
        return phrase
455
385
    else:
456
386
        if repository.is_shared():
464
394
        if branch is None and tree is not None:
465
395
            phrase = "branchless tree"
466
396
        else:
467
 
            if (tree is not None and tree.user_url !=
468
 
                branch.user_url):
 
397
            if (tree is not None and tree.bzrdir.root_transport.base !=
 
398
                branch.bzrdir.root_transport.base):
469
399
                independence = ''
470
400
                phrase = "Lightweight checkout"
471
401
            elif branch.get_bound_location() is not None:
490
420
    """
491
421
    candidates  = []
492
422
    if (branch is not None and tree is not None and
493
 
        branch.user_url != tree.user_url):
 
423
        branch.bzrdir.root_transport.base !=
 
424
        tree.bzrdir.root_transport.base):
494
425
        branch = None
495
426
        repository = None
496
 
    non_aliases = set(controldir.format_registry.keys())
497
 
    non_aliases.difference_update(controldir.format_registry.aliases())
498
 
    for key in non_aliases:
499
 
        format = controldir.format_registry.make_bzrdir(key)
 
427
    for key in bzrdir.format_registry.keys():
 
428
        format = bzrdir.format_registry.make_bzrdir(key)
500
429
        if isinstance(format, bzrdir.BzrDirMetaFormat1):
501
430
            if (tree and format.workingtree_format !=
502
431
                tree._format):
512
441
        candidates.append(key)
513
442
    if len(candidates) == 0:
514
443
        return 'unnamed'
515
 
    candidates.sort()
 
444
    new_candidates = [c for c in candidates if c != 'default']
 
445
    if len(new_candidates) > 0:
 
446
        candidates = new_candidates
516
447
    new_candidates = [c for c in candidates if not
517
 
        controldir.format_registry.get_info(c).hidden]
 
448
        bzrdir.format_registry.get_info(c).hidden]
518
449
    if len(new_candidates) > 0:
519
 
        # If there are any non-hidden formats that match, only return those to
520
 
        # avoid listing hidden formats except when only a hidden format will
521
 
        # do.
522
450
        candidates = new_candidates
523
451
    return ' or '.join(candidates)
524
452
 
525
 
 
526
 
class InfoHooks(_mod_hooks.Hooks):
527
 
    """Hooks for the info command."""
528
 
 
529
 
    def __init__(self):
530
 
        super(InfoHooks, self).__init__("bzrlib.info", "hooks")
531
 
        self.add_hook('repository',
532
 
            "Invoked when displaying the statistics for a repository. "
533
 
            "repository is called with a statistics dictionary as returned "
534
 
            "by the repository and a file-like object to write to.", (1, 15))
535
 
 
536
 
 
537
 
hooks = InfoHooks()
 
453
@deprecated_function(zero_eight)
 
454
def show_info(b):
 
455
    """Please see show_bzrdir_info."""
 
456
    return show_bzrdir_info(b.bzrdir)
 
457
 
 
458
 
 
459
@deprecated_function(zero_eighteen)
 
460
def show_tree_info(working, verbose):
 
461
    """Output to stdout the 'info' for working."""
 
462
    branch = working.branch
 
463
    repository = branch.repository
 
464
    control = working.bzrdir
 
465
    show_component_info(control, repository, branch, working, verbose)
 
466
 
 
467
 
 
468
@deprecated_function(zero_eighteen)
 
469
def show_branch_info(branch, verbose):
 
470
    """Output to stdout the 'info' for branch."""
 
471
    repository = branch.repository
 
472
    control = branch.bzrdir
 
473
    show_component_info(control, repository, branch, verbose=verbose)
 
474
 
 
475
 
 
476
@deprecated_function(zero_eighteen)
 
477
def show_repository_info(repository, verbose):
 
478
    """Output to stdout the 'info' for repository."""
 
479
    control = repository.bzrdir
 
480
    show_component_info(control, repository, verbose=verbose)