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
23
from osutils import format_date
21
from bzrlib.osutils import format_date
25
# surely there's a builtin for this?
26
print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
36
print 'branch format:', b.control_files.controlfile(
37
'branch-format', 'r').readline().rstrip('\n')
28
39
def plural(n, base='', pl=None):
36
47
count_version_dirs = 0
38
count_status = {'A': 0, 'D': 0, 'M': 0, 'R': 0, '?': 0, 'I': 0, '.': 0}
39
for st_tup in bzrlib.diff_trees(b.basis_tree(), b.working_tree()):
42
if fs not in ['I', '?'] and st_tup[4] == 'directory':
43
count_version_dirs += 1
49
basis = b.basis_tree()
50
working = b.working_tree()
51
work_inv = working.inventory
52
delta = diff.compare_trees(basis, working, want_unchanged=True)
46
55
print 'in the working tree:'
47
for name, fs in (('unchanged', '.'),
48
('modified', 'M'), ('added', 'A'), ('removed', 'D'),
49
('renamed', 'R'), ('unknown', '?'), ('ignored', 'I'),
51
print ' %8d %s' % (count_status[fs], name)
52
print ' %8d versioned subdirector%s' % (count_version_dirs,
53
plural(count_version_dirs, 'y', 'ies'))
56
print ' %8s unchanged' % len(delta.unchanged)
57
print ' %8d modified' % len(delta.modified)
58
print ' %8d added' % len(delta.added)
59
print ' %8d removed' % len(delta.removed)
60
print ' %8d renamed' % len(delta.renamed)
62
ignore_cnt = unknown_cnt = 0
63
for path in working.extras():
64
if working.is_ignored(path):
69
print ' %8d unknown' % unknown_cnt
70
print ' %8d ignored' % ignore_cnt
73
for file_id in work_inv:
74
if work_inv.get_file_kind(file_id) == 'directory':
76
print ' %8d versioned %s' \
78
plural(dir_cnt, 'subdirectory', 'subdirectories'))
56
81
print 'branch history:'
57
82
history = b.revision_history()
58
83
revno = len(history)
59
84
print ' %8d revision%s' % (revno, plural(revno))
61
86
for rev in history:
62
committers.add(b.get_revision(rev).committer)
87
committers[b.repository.get_revision(rev).committer] = True
63
88
print ' %8d committer%s' % (len(committers), plural(len(committers)))
65
firstrev = b.get_revision(history[0])
90
firstrev = b.repository.get_revision(history[0])
66
91
age = int((time.time() - firstrev.timestamp) / 3600 / 24)
67
92
print ' %8d day%s old' % (age, plural(age))
68
93
print ' first revision: %s' % format_date(firstrev.timestamp,
71
lastrev = b.get_revision(history[-1])
96
lastrev = b.repository.get_revision(history[-1])
72
97
print ' latest revision: %s' % format_date(lastrev.timestamp,
77
c, t = b.text_store.total_size()
78
print ' %8d file texts' % c
79
print ' %8d kB' % (t/1024)
101
# print 'text store:'
102
# c, t = b.text_store.total_size()
103
# print ' %8d file texts' % c
104
# print ' %8d kB' % (t/1024)
82
107
print 'revision store:'
83
c, t = b.revision_store.total_size()
108
c, t = b.repository.revision_store.total_size()
84
109
print ' %8d revisions' % c
85
110
print ' %8d kB' % (t/1024)
89
print 'inventory store:'
90
c, t = b.inventory_store.total_size()
91
print ' %8d inventories' % c
92
print ' %8d kB' % (t/1024)
114
# print 'inventory store:'
115
# c, t = b.inventory_store.total_size()
116
# print ' %8d inventories' % c
117
# print ' %8d kB' % (t/1024)