~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Jelmer Vernooij
  • Date: 2010-08-28 11:20:04 UTC
  • mto: This revision was merged to the branch mainline in revision 5418.
  • Revision ID: jelmer@samba.org-20100828112004-83vag2ktvihjlt40
Fix some test failures now that bzrlib.controldir.network_format_registry has moved.

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
224
225
    branch_revno, branch_last_revision = branch.last_revision_info()
225
226
    try:
226
227
        tree_last_id = working.get_parent_ids()[0]
238
239
def _show_working_stats(working, outfile):
239
240
    """Show statistics about a working tree."""
240
241
    basis = working.basis_tree()
 
242
    work_inv = working.inventory
241
243
    delta = working.changes_from(basis, want_unchanged=True)
242
244
 
243
245
    outfile.write('\n')
258
260
    outfile.write('  %8d ignored\n' % ignore_cnt)
259
261
 
260
262
    dir_cnt = 0
261
 
    root_id = working.get_root_id()
262
 
    for path, entry in working.iter_entries_by_dir():
263
 
        if entry.kind == 'directory' and entry.file_id != root_id:
 
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
266
            dir_cnt += 1
265
267
    outfile.write('  %8d versioned %s\n' % (dir_cnt,
266
268
        plural(dir_cnt, 'subdirectory', 'subdirectories')))
479
481
    """Hooks for the info command."""
480
482
 
481
483
    def __init__(self):
482
 
        super(InfoHooks, self).__init__("bzrlib.info", "hooks")
483
 
        self.add_hook('repository',
 
484
        super(InfoHooks, self).__init__()
 
485
        self.create_hook(_mod_hooks.HookPoint('repository',
484
486
            "Invoked when displaying the statistics for a repository. "
485
487
            "repository is called with a statistics dictionary as returned "
486
 
            "by the repository and a file-like object to write to.", (1, 15))
 
488
            "by the repository and a file-like object to write to.", (1, 15), 
 
489
            None))
487
490
 
488
491
 
489
492
hooks = InfoHooks()