~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Jelmer Vernooij
  • Date: 2011-10-06 00:14:01 UTC
  • mto: This revision was merged to the branch mainline in revision 6216.
  • Revision ID: jelmer@samba.org-20111006001401-o14rsyp6gdy5vt3o
Fix plugin use of revision_history.

Show diffs side-by-side

added added

removed removed

Lines of Context:
221
221
    """Show missing revisions in working tree."""
222
222
    branch = working.branch
223
223
    basis = working.basis_tree()
224
 
    work_inv = working.inventory
225
 
    branch_revno, branch_last_revision = branch.last_revision_info()
 
224
    try:
 
225
        branch_revno, branch_last_revision = branch.last_revision_info()
 
226
    except errors.UnsupportedOperation:
 
227
        return
226
228
    try:
227
229
        tree_last_id = working.get_parent_ids()[0]
228
230
    except IndexError:
239
241
def _show_working_stats(working, outfile):
240
242
    """Show statistics about a working tree."""
241
243
    basis = working.basis_tree()
242
 
    work_inv = working.inventory
243
244
    delta = working.changes_from(basis, want_unchanged=True)
244
245
 
245
246
    outfile.write('\n')
260
261
    outfile.write('  %8d ignored\n' % ignore_cnt)
261
262
 
262
263
    dir_cnt = 0
263
 
    for file_id in work_inv:
264
 
        if (work_inv.get_file_kind(file_id) == 'directory' and
265
 
            not work_inv.is_root(file_id)):
 
264
    root_id = working.get_root_id()
 
265
    for path, entry in working.iter_entries_by_dir():
 
266
        if entry.kind == 'directory' and entry.file_id != root_id:
266
267
            dir_cnt += 1
267
268
    outfile.write('  %8d versioned %s\n' % (dir_cnt,
268
269
        plural(dir_cnt, 'subdirectory', 'subdirectories')))
270
271
 
271
272
def _show_branch_stats(branch, verbose, outfile):
272
273
    """Show statistics about a branch."""
273
 
    revno, head = branch.last_revision_info()
 
274
    try:
 
275
        revno, head = branch.last_revision_info()
 
276
    except errors.UnsupportedOperation:
 
277
        return {}
274
278
    outfile.write('\n')
275
279
    outfile.write('Branch history:\n')
276
280
    outfile.write('  %8d revision%s\n' % (revno, plural(revno)))
481
485
    """Hooks for the info command."""
482
486
 
483
487
    def __init__(self):
484
 
        super(InfoHooks, self).__init__()
485
 
        self.create_hook(_mod_hooks.HookPoint('repository',
 
488
        super(InfoHooks, self).__init__("bzrlib.info", "hooks")
 
489
        self.add_hook('repository',
486
490
            "Invoked when displaying the statistics for a repository. "
487
491
            "repository is called with a statistics dictionary as returned "
488
 
            "by the repository and a file-like object to write to.", (1, 15), 
489
 
            None))
 
492
            "by the repository and a file-like object to write to.", (1, 15))
490
493
 
491
494
 
492
495
hooks = InfoHooks()