~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/info.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-09 19:25:42 UTC
  • mto: (5777.5.1 inventoryworkingtree)
  • mto: This revision was merged to the branch mainline in revision 5781.
  • Revision ID: jelmer@samba.org-20110409192542-8bbedp36s7nj928e
Split InventoryTree out of Tree.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
from bzrlib import (
24
24
    bzrdir,
25
 
    controldir,
26
25
    errors,
27
26
    hooks as _mod_hooks,
28
27
    osutils,
222
221
    """Show missing revisions in working tree."""
223
222
    branch = working.branch
224
223
    basis = working.basis_tree()
225
 
    try:
226
 
        branch_revno, branch_last_revision = branch.last_revision_info()
227
 
    except errors.UnsupportedOperation:
228
 
        return
 
224
    work_inv = working.inventory
 
225
    branch_revno, branch_last_revision = branch.last_revision_info()
229
226
    try:
230
227
        tree_last_id = working.get_parent_ids()[0]
231
228
    except IndexError:
242
239
def _show_working_stats(working, outfile):
243
240
    """Show statistics about a working tree."""
244
241
    basis = working.basis_tree()
 
242
    work_inv = working.inventory
245
243
    delta = working.changes_from(basis, want_unchanged=True)
246
244
 
247
245
    outfile.write('\n')
262
260
    outfile.write('  %8d ignored\n' % ignore_cnt)
263
261
 
264
262
    dir_cnt = 0
265
 
    root_id = working.get_root_id()
266
 
    for path, entry in working.iter_entries_by_dir():
267
 
        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)):
268
266
            dir_cnt += 1
269
267
    outfile.write('  %8d versioned %s\n' % (dir_cnt,
270
268
        plural(dir_cnt, 'subdirectory', 'subdirectories')))
272
270
 
273
271
def _show_branch_stats(branch, verbose, outfile):
274
272
    """Show statistics about a branch."""
275
 
    try:
276
 
        revno, head = branch.last_revision_info()
277
 
    except errors.UnsupportedOperation:
278
 
        return {}
 
273
    revno, head = branch.last_revision_info()
279
274
    outfile.write('\n')
280
275
    outfile.write('Branch history:\n')
281
276
    outfile.write('  %8d revision%s\n' % (revno, plural(revno)))
337
332
                repository = a_bzrdir.open_repository()
338
333
            except NoRepositoryPresent:
339
334
                # Return silently; cmd_info already returned NotBranchError
340
 
                # if no controldir could be opened.
 
335
                # if no bzrdir could be opened.
341
336
                return
342
337
            else:
343
338
                lockable = repository
452
447
        branch.user_url != tree.user_url):
453
448
        branch = None
454
449
        repository = None
455
 
    non_aliases = set(controldir.format_registry.keys())
456
 
    non_aliases.difference_update(controldir.format_registry.aliases())
 
450
    non_aliases = set(bzrdir.format_registry.keys())
 
451
    non_aliases.difference_update(bzrdir.format_registry.aliases())
457
452
    for key in non_aliases:
458
 
        format = controldir.format_registry.make_bzrdir(key)
 
453
        format = bzrdir.format_registry.make_bzrdir(key)
459
454
        if isinstance(format, bzrdir.BzrDirMetaFormat1):
460
455
            if (tree and format.workingtree_format !=
461
456
                tree._format):
473
468
        return 'unnamed'
474
469
    candidates.sort()
475
470
    new_candidates = [c for c in candidates if not
476
 
        controldir.format_registry.get_info(c).hidden]
 
471
        bzrdir.format_registry.get_info(c).hidden]
477
472
    if len(new_candidates) > 0:
478
473
        # If there are any non-hidden formats that match, only return those to
479
474
        # avoid listing hidden formats except when only a hidden format will