27
27
from bzrlib.errors import (NoWorkingTree, NotBranchError,
28
28
NoRepositoryPresent, NotLocalUrl)
29
29
from bzrlib.missing import find_unmerged
30
from bzrlib.symbol_versioning import (deprecated_function,
30
from bzrlib.symbol_versioning import (deprecated_function,
176
176
branch = working.branch
177
177
basis = working.basis_tree()
178
178
work_inv = working.inventory
179
history = branch.revision_history()
179
branch_revno, branch_last_revision = branch.last_revision_info()
181
181
tree_last_id = working.get_parent_ids()[0]
182
182
except IndexError:
183
183
tree_last_id = None
185
if len(history) and tree_last_id != history[-1]:
185
if branch_revno and tree_last_id != branch_last_revision:
186
186
tree_last_revno = branch.revision_id_to_revno(tree_last_id)
187
missing_count = len(history) - tree_last_revno
187
missing_count = branch_revno - tree_last_revno
189
189
print 'Working tree is out of date: missing %d revision%s.' % (
190
190
missing_count, plural(missing_count))
226
226
def _show_branch_stats(branch, verbose):
227
227
"""Show statistics about a branch."""
228
repository = branch.repository
229
history = branch.revision_history()
228
revno, head = branch.last_revision_info()
232
230
print 'Branch history:'
234
231
print ' %8d revision%s' % (revno, plural(revno))
232
stats = branch.repository.gather_stats(head, committers=verbose)
238
committers[repository.get_revision(rev).committer] = True
239
print ' %8d committer%s' % (len(committers), plural(len(committers)))
241
firstrev = repository.get_revision(history[0])
242
age = int((time.time() - firstrev.timestamp) / 3600 / 24)
234
committers = stats['committers']
235
print ' %8d committer%s' % (committers, plural(committers))
237
timestamp, timezone = stats['firstrev']
238
age = int((time.time() - timestamp) / 3600 / 24)
243
239
print ' %8d day%s old' % (age, plural(age))
244
print ' first revision: %s' % osutils.format_date(firstrev.timestamp,
247
lastrev = repository.get_revision(history[-1])
248
print ' latest revision: %s' % osutils.format_date(lastrev.timestamp,
252
# print 'Text store:'
253
# c, t = branch.text_store.total_size()
254
# print ' %8d file texts' % c
255
# print ' %8d KiB' % (t/1024)
258
# print 'Inventory store:'
259
# c, t = branch.inventory_store.total_size()
260
# print ' %8d inventories' % c
261
# print ' %8d KiB' % (t/1024)
240
print ' first revision: %s' % osutils.format_date(timestamp,
242
timestamp, timezone = stats['latestrev']
243
print ' latest revision: %s' % osutils.format_date(timestamp,
264
248
def _show_repository_info(repository):
268
252
print 'Create working tree for new branches inside the repository.'
271
def _show_repository_stats(repository):
255
def _show_repository_stats(stats):
272
256
"""Show statistics about a repository."""
273
if repository.bzrdir.root_transport.listable():
257
if 'revisions' in stats or 'size' in stats:
275
259
print 'Revision store:'
276
c, t = repository._revision_store.total_size(repository.get_transaction())
277
print ' %8d revision%s' % (c, plural(c))
278
print ' %8d KiB' % (t/1024)
260
if 'revisions' in stats:
261
revisions = stats['revisions']
262
print ' %8d revision%s' % (revisions, plural(revisions))
264
print ' %8d KiB' % (stats['size']/1024)
281
267
@deprecated_function(zero_eight)
336
322
_show_missing_revisions_branch(branch)
337
323
_show_missing_revisions_working(working)
338
324
_show_working_stats(working)
339
_show_branch_stats(branch, verbose)
340
_show_repository_stats(repository)
325
stats = _show_branch_stats(branch, verbose)
326
_show_repository_stats(stats)
343
329
def show_branch_info(branch, verbose):
350
336
_show_format_info(control, repository, branch)
351
337
_show_locking_info(repository, branch)
352
338
_show_missing_revisions_branch(branch)
353
_show_branch_stats(branch, verbose)
354
_show_repository_stats(repository)
339
stats = _show_branch_stats(branch, verbose)
340
_show_repository_stats(stats)
357
343
def show_repository_info(repository, verbose):
362
348
_show_format_info(control, repository)
363
349
_show_locking_info(repository)
364
350
_show_repository_info(repository)
365
_show_repository_stats(repository)
351
stats = repository.gather_stats()
352
_show_repository_stats(stats)