264
264
print ' %8d KiB' % (stats['size']/1024)
267
def show_bzrdir_info(a_bzrdir, verbose=False):
268
"""Output to stdout the 'info' for a_bzrdir."""
270
tree = a_bzrdir.open_workingtree()
271
except (NoWorkingTree, NotLocalUrl):
274
branch = a_bzrdir.open_branch()
275
except NotBranchError:
278
repository = a_bzrdir.open_repository()
279
except NoRepositoryPresent:
280
# Return silently; cmd_info already returned NotBranchError
281
# if no bzrdir could be opened.
284
lockable = repository
286
repository = branch.repository
290
repository = branch.repository
295
show_component_info(a_bzrdir, repository, branch, tree, verbose)
300
def show_component_info(control, repository, branch=None, working=None,
302
"""Write info about all bzrdir components to stdout"""
303
verbose = {False: 1, True: 2}.get(verbose, verbose)
304
_show_location_info(repository, branch, working)
305
if branch is not None:
306
_show_related_info(branch)
307
_show_format_info(control, repository, branch, working)
308
_show_locking_info(repository, branch, working)
309
if branch is not None:
310
_show_missing_revisions_branch(branch)
311
if working is not None:
312
_show_missing_revisions_working(working)
313
_show_working_stats(working)
314
elif branch is not None:
315
_show_missing_revisions_branch(branch)
316
if branch is not None:
317
stats = _show_branch_stats(branch, verbose==2)
319
stats = repository.gather_stats()
320
if branch is None and working is None:
321
_show_repository_info(repository)
322
_show_repository_stats(stats)
267
325
@deprecated_function(zero_eight)
268
326
def show_info(b):
269
327
"""Please see show_bzrdir_info."""
270
328
return show_bzrdir_info(b.bzrdir)
273
def show_bzrdir_info(a_bzrdir, verbose=False):
274
"""Output to stdout the 'info' for a_bzrdir."""
276
working = a_bzrdir.open_workingtree()
279
show_tree_info(working, verbose)
283
except (NoWorkingTree, NotLocalUrl):
287
branch = a_bzrdir.open_branch()
290
show_branch_info(branch, verbose)
294
except NotBranchError:
298
repository = a_bzrdir.open_repository()
299
repository.lock_read()
301
show_repository_info(repository, verbose)
305
except NoRepositoryPresent:
308
# Return silently, cmd_info already returned NotBranchError if no bzrdir
331
@deprecated_function(zero_sixteen)
312
332
def show_tree_info(working, verbose):
313
333
"""Output to stdout the 'info' for working."""
314
334
branch = working.branch
315
335
repository = branch.repository
316
336
control = working.bzrdir
318
_show_location_info(repository, branch, working)
319
_show_related_info(branch)
320
_show_format_info(control, repository, branch, working)
321
_show_locking_info(repository, branch, working)
322
_show_missing_revisions_branch(branch)
323
_show_missing_revisions_working(working)
324
_show_working_stats(working)
325
stats = _show_branch_stats(branch, verbose)
326
_show_repository_stats(stats)
337
show_component_info(control, repository, branch, working, verbose)
340
@deprecated_function(zero_sixteen)
329
341
def show_branch_info(branch, verbose):
330
342
"""Output to stdout the 'info' for branch."""
331
343
repository = branch.repository
332
344
control = branch.bzrdir
334
_show_location_info(repository, branch)
335
_show_related_info(branch)
336
_show_format_info(control, repository, branch)
337
_show_locking_info(repository, branch)
338
_show_missing_revisions_branch(branch)
339
stats = _show_branch_stats(branch, verbose)
340
_show_repository_stats(stats)
345
show_component_info(control, repository, branch, verbose=verbose)
348
@deprecated_function(zero_sixteen)
343
349
def show_repository_info(repository, verbose):
344
350
"""Output to stdout the 'info' for repository."""
345
351
control = repository.bzrdir
347
_show_location_info(repository)
348
_show_format_info(control, repository)
349
_show_locking_info(repository)
350
_show_repository_info(repository)
351
stats = repository.gather_stats()
352
_show_repository_stats(stats)
352
show_component_info(control, repository, verbose=verbose)