16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
from bzrlib.osutils import format_date
25
# surely there's a builtin for this?
23
from osutils import format_date
26
# TODO: Maybe show space used by working tree, versioned files,
27
# unknown files, text store.
36
29
print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
38
31
def plural(n, base='', pl=None):
46
39
count_version_dirs = 0
48
basis = b.basis_tree()
49
working = b.working_tree()
50
work_inv = working.inventory
51
delta = diff.compare_trees(basis, working, want_unchanged=True)
41
count_status = {'A': 0, 'D': 0, 'M': 0, 'R': 0, '?': 0, 'I': 0, '.': 0}
42
for st_tup in bzrlib.diff_trees(b.basis_tree(), b.working_tree()):
45
if fs not in ['I', '?'] and st_tup[4] == 'directory':
46
count_version_dirs += 1
54
49
print 'in the working tree:'
55
print ' %8s unchanged' % len(delta.unchanged)
56
print ' %8d modified' % len(delta.modified)
57
print ' %8d added' % len(delta.added)
58
print ' %8d removed' % len(delta.removed)
59
print ' %8d renamed' % len(delta.renamed)
61
ignore_cnt = unknown_cnt = 0
62
for path in working.extras():
63
if working.is_ignored(path):
68
print ' %8d unknown' % unknown_cnt
69
print ' %8d ignored' % ignore_cnt
72
for file_id in work_inv:
73
if work_inv.get_file_kind(file_id) == 'directory':
75
print ' %8d versioned %s' \
77
plural(dir_cnt, 'subdirectory', 'subdirectories'))
50
for name, fs in (('unchanged', '.'),
51
('modified', 'M'), ('added', 'A'), ('removed', 'D'),
52
('renamed', 'R'), ('unknown', '?'), ('ignored', 'I'),
54
print ' %5d %s' % (count_status[fs], name)
55
print ' %5d versioned subdirector%s' % (count_version_dirs,
56
plural(count_version_dirs, 'y', 'ies'))
80
59
print 'branch history:'
81
60
history = b.revision_history()
82
61
revno = len(history)
83
print ' %8d revision%s' % (revno, plural(revno))
62
print ' %5d revision%s' % (revno, plural(revno))
85
64
for rev in history:
86
committers[b.get_revision(rev).committer] = True
87
print ' %8d committer%s' % (len(committers), plural(len(committers)))
65
committers.add(b.get_revision(rev).committer)
66
print ' %5d committer%s' % (len(committers), plural(len(committers)))
89
68
firstrev = b.get_revision(history[0])
90
69
age = int((time.time() - firstrev.timestamp) / 3600 / 24)
91
print ' %8d day%s old' % (age, plural(age))
70
print ' %5d day%s old' % (age, plural(age))
92
71
print ' first revision: %s' % format_date(firstrev.timestamp,
96
75
print ' latest revision: %s' % format_date(lastrev.timestamp,
100
# print 'text store:'
101
# c, t = b.text_store.total_size()
102
# print ' %8d file texts' % c
103
# print ' %8d kB' % (t/1024)
80
c, t = b.text_store.total_size()
81
print ' %5d file texts' % c
82
print ' %5d kB' % (t/1024)
106
85
print 'revision store:'
107
86
c, t = b.revision_store.total_size()
108
print ' %8d revisions' % c
109
print ' %8d kB' % (t/1024)
113
# print 'inventory store:'
114
# c, t = b.inventory_store.total_size()
115
# print ' %8d inventories' % c
116
# print ' %8d kB' % (t/1024)
87
print ' %5d revisions' % c
88
print ' %5d kB' % (t/1024)
92
print 'inventory store:'
93
c, t = b.inventory_store.total_size()
94
print ' %5d inventories' % c
95
print ' %5d kB' % (t/1024)