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
19
__all__ = ['show_bzrdir_info']
21
from osutils import format_date
24
import bzrlib.diff as diff
25
from bzrlib.osutils import format_date
26
from bzrlib.symbol_versioning import *
24
29
def _countiter(it):
37
@deprecated_function(zero_eight)
39
"""Please see show_bzrdir_info."""
40
return show_bzrdir_info(b.bzrdir)
42
def show_bzrdir_info(a_bzrdir):
43
"""Output to stdout the 'info' for a_bzrdir."""
45
working = a_bzrdir.open_workingtree()
46
b = a_bzrdir.open_branch()
36
print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
48
if working.bzrdir != b.bzrdir:
49
print 'working tree format:', working._format
50
print 'branch location:', b.bzrdir.root_transport.base
52
b._format.get_format_string()
54
except NotImplementedError:
55
format = b.bzrdir._format
56
print 'branch format:', format
38
58
def plural(n, base='', pl=None):
46
66
count_version_dirs = 0
48
basis = b.basis_tree()
49
working = b.working_tree()
68
basis = working.basis_tree()
50
69
work_inv = working.inventory
51
70
delta = diff.compare_trees(basis, working, want_unchanged=True)
71
history = b.revision_history()
74
if len(history) and working.last_revision() != history[-1]:
76
missing_count = len(history) - history.index(working.last_revision())
78
# consider it all out of date
79
missing_count = len(history)
80
print 'Working tree is out of date: missing %d revision%s.' % (
81
missing_count, plural(missing_count))
54
82
print 'in the working tree:'
55
83
print ' %8s unchanged' % len(delta.unchanged)
56
84
print ' %8d modified' % len(delta.modified)
80
108
print 'branch history:'
81
history = b.revision_history()
82
109
revno = len(history)
83
110
print ' %8d revision%s' % (revno, plural(revno))
85
112
for rev in history:
86
committers[b.get_revision(rev).committer] = True
113
committers[b.repository.get_revision(rev).committer] = True
87
114
print ' %8d committer%s' % (len(committers), plural(len(committers)))
89
firstrev = b.get_revision(history[0])
116
firstrev = b.repository.get_revision(history[0])
90
117
age = int((time.time() - firstrev.timestamp) / 3600 / 24)
91
118
print ' %8d day%s old' % (age, plural(age))
92
119
print ' first revision: %s' % format_date(firstrev.timestamp,
93
120
firstrev.timezone)
95
lastrev = b.get_revision(history[-1])
122
lastrev = b.repository.get_revision(history[-1])
96
123
print ' latest revision: %s' % format_date(lastrev.timestamp,
101
c, t = b.text_store.total_size()
102
print ' %8d file texts' % c
103
print ' %8d kB' % (t/1024)
127
# print 'text store:'
128
# c, t = b.text_store.total_size()
129
# print ' %8d file texts' % c
130
# print ' %8d kB' % (t/1024)
106
133
print 'revision store:'
107
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)
134
c, t = b.repository.revision_store.total_size()
135
print ' %8d revision%s' % (c, plural(c))
136
print ' %8d kB' % (t/1024)
140
# print 'inventory store:'
141
# c, t = b.inventory_store.total_size()
142
# print ' %8d inventories' % c
143
# print ' %8d kB' % (t/1024)