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']
24
import bzrlib.diff as diff
25
from bzrlib.missing import find_unmerged
26
from bzrlib.osutils import format_date
27
from bzrlib.symbol_versioning import *
21
from osutils import format_date
30
24
def _countiter(it):
38
def plural(n, base='', pl=None):
47
@deprecated_function(zero_eight)
49
"""Please see show_bzrdir_info."""
50
return show_bzrdir_info(b.bzrdir)
53
def show_bzrdir_info(a_bzrdir):
54
"""Output to stdout the 'info' for a_bzrdir."""
56
working = a_bzrdir.open_workingtree()
59
show_tree_info(working)
64
def show_tree_info(working):
65
"""Output to stdout the 'info' for working."""
69
if working.bzrdir != b.bzrdir:
70
print 'working tree format:', working._format
71
print 'branch location:', b.bzrdir.root_transport.base
73
b._format.get_format_string()
75
except NotImplementedError:
76
format = b.bzrdir._format
77
print 'branch format:', format
36
print 'branch format:', b.controlfile('branch-format', 'r').readline().rstrip('\n')
79
if b.get_bound_location():
80
print 'bound to branch:', b.get_bound_location()
38
def plural(n, base='', pl=None):
82
46
count_version_dirs = 0
84
basis = working.basis_tree()
48
basis = b.basis_tree()
49
working = b.working_tree()
85
50
work_inv = working.inventory
86
51
delta = diff.compare_trees(basis, working, want_unchanged=True)
87
history = b.revision_history()
90
# Try with inaccessible branch ?
91
master = b.get_master_branch()
93
local_extra, remote_extra = find_unmerged(b, b.get_master_branch())
95
print 'Branch is out of date: missing %d revision%s.' % (
96
len(remote_extra), plural(len(remote_extra)))
98
if len(history) and working.last_revision() != history[-1]:
100
missing_count = len(history) - history.index(working.last_revision())
102
# consider it all out of date
103
missing_count = len(history)
104
print 'Working tree is out of date: missing %d revision%s.' % (
105
missing_count, plural(missing_count))
106
54
print 'in the working tree:'
107
55
print ' %8s unchanged' % len(delta.unchanged)
108
56
print ' %8d modified' % len(delta.modified)
132
80
print 'branch history:'
81
history = b.revision_history()
133
82
revno = len(history)
134
83
print ' %8d revision%s' % (revno, plural(revno))
136
85
for rev in history:
137
committers[b.repository.get_revision(rev).committer] = True
86
committers[b.get_revision(rev).committer] = True
138
87
print ' %8d committer%s' % (len(committers), plural(len(committers)))
140
firstrev = b.repository.get_revision(history[0])
89
firstrev = b.get_revision(history[0])
141
90
age = int((time.time() - firstrev.timestamp) / 3600 / 24)
142
91
print ' %8d day%s old' % (age, plural(age))
143
92
print ' first revision: %s' % format_date(firstrev.timestamp,
144
93
firstrev.timezone)
146
lastrev = b.repository.get_revision(history[-1])
95
lastrev = b.get_revision(history[-1])
147
96
print ' latest revision: %s' % format_date(lastrev.timestamp,
151
# print 'text store:'
152
# c, t = b.text_store.total_size()
153
# print ' %8d file texts' % c
154
# print ' %8d kB' % (t/1024)
101
c, t = b.text_store.total_size()
102
print ' %8d file texts' % c
103
print ' %8d kB' % (t/1024)
157
106
print 'revision store:'
158
c, t = b.repository._revision_store.total_size(b.repository.get_transaction())
159
print ' %8d revision%s' % (c, plural(c))
160
print ' %8d kB' % (t/1024)
164
# print 'inventory store:'
165
# c, t = b.inventory_store.total_size()
166
# print ' %8d inventories' % c
167
# print ' %8d kB' % (t/1024)
172
print 'parent location:'
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)