54
55
return object.bzrdir._format # Use rstrip to be safe?
58
def _print_other_locations(branch):
59
"""Output to stdout the parent, bound and push locations of branch,
62
if branch.get_parent():
63
print ' Parent branch: %s' % branch.get_parent()
64
if branch.get_bound_location():
65
print ' Bound to branch: %s' % branch.get_bound_location()
66
if branch.get_push_location():
67
print ' Push to branch: %s' % branch.get_push_location()
70
def _print_formats(working_format, branch_format, repository_format):
71
"""Output to stdout the formats given, if not None."""
73
print ' Working tree format: %s' % working_format
75
print ' Branch format: %s' % branch_format
77
print ' Repository format: %s' % repository_format
57
80
@deprecated_function(zero_eight)
59
82
"""Please see show_bzrdir_info."""
74
97
def show_tree_info(working, debug):
75
98
"""Output to stdout the 'info' for working."""
78
repository = b.repository
100
branch = working.branch
101
repository = branch.repository
79
102
working_format = _get_format_string(working)
80
branch_format = _get_format_string(b)
103
branch_format = _get_format_string(branch)
81
104
repository_format = _get_format_string(repository)
105
# TODO Is it possible to get metadir format?
84
108
print ' working.bzrdir = %s' % working.bzrdir.root_transport.base
85
print ' branch.bzrdir = %s' % b.bzrdir.root_transport.base
109
print ' branch.bzrdir = %s' % branch.bzrdir.root_transport.base
86
110
print 'repository.bzrdir = %s' % repository.bzrdir.root_transport.base
87
print ' branch.parent = %s' % (b.get_parent() or '')
88
print ' branch.push = %s' % (b.get_push_location() or '')
89
print ' branch.bound = %s' % (b.get_bound_location() or '')
111
print ' branch.parent = %s' % (branch.get_parent() or '')
112
print ' branch.push = %s' % (branch.get_push_location() or '')
113
print ' branch.bound = %s' % (branch.get_bound_location() or '')
90
114
print ' working.format = %s' % working_format
91
115
print ' branch.format = %s' % branch_format
92
116
print 'repository.format = %s' % repository_format
93
117
print 'repository.shared = %s' % repository.is_shared()
96
if working.bzrdir != b.bzrdir:
97
print 'working tree format:', working._format
98
print 'branch location:', b.bzrdir.root_transport.base
100
b._format.get_format_string()
102
except NotImplementedError:
103
format = b.bzrdir._format
104
print 'branch format:', format
106
if b.get_bound_location():
107
print 'bound to branch:', b.get_bound_location()
120
if working.bzrdir == branch.bzrdir:
121
if working.bzrdir == repository.bzrdir:
122
if working_format == branch_format == repository_format:
124
print ' Branch root: %s' \
125
% branch.bzrdir.root_transport.base
126
_print_other_locations(branch)
128
_print_formats(None, branch_format, None)
130
# checkout (bound branch)
131
print ' Checkout root: %s' \
132
% branch.bzrdir.root_transport.base
133
_print_other_locations(branch)
135
_print_formats(working_format, branch_format,
138
# working tree inside branch of shared repository
139
print ' Checkout root: %s' \
140
% branch.bzrdir.root_transport.base
141
if repository.is_shared():
142
print ' Shared repository: %s' \
143
% repository.bzrdir.root_transport.base
145
print ' Repository: %s' \
146
% repository.bzrdir.root_transport.base
147
_print_other_locations(branch)
149
_print_formats(working_format, branch_format, repository_format)
151
if working.bzrdir == repository.bzrdir:
152
# strange variation of lightweight checkout
153
# Working has the same location as repository, but not branch.
154
# FIXME This UI needs review, just show all values for now.
155
warning('User interface for this construct needs to be tuned.')
156
print ' Working tree: %s' \
157
% working.bzrdir.root_transport.base
158
print ' Checkout of branch: %s' \
159
% branch.bzrdir.root_transport.base
160
if repository.is_shared():
161
print ' Shared repository: %s' \
162
% repository.bzrdir.root_transport.base
164
print ' Repository: %s' \
165
% repository.bzrdir.root_transport.base
167
# lightweight checkout (could be of standalone branch)
168
print ' Working tree: %s' \
169
% working.bzrdir.root_transport.base
170
print ' Checkout of branch: %s' \
171
% branch.bzrdir.root_transport.base
172
if branch.bzrdir != repository.bzrdir:
173
# lightweight checkout
174
if repository.is_shared():
175
print ' Shared repository: %s' \
176
% repository.bzrdir.root_transport.base
178
print ' Repository: %s' \
179
% repository.bzrdir.root_transport.base
180
_print_other_locations(branch)
182
_print_formats(working_format, branch_format, repository_format)
109
184
count_version_dirs = 0
111
186
basis = working.basis_tree()
112
187
work_inv = working.inventory
113
188
delta = diff.compare_trees(basis, working, want_unchanged=True)
114
history = b.revision_history()
189
history = branch.revision_history()
117
192
# Try with inaccessible branch ?
118
master = b.get_master_branch()
193
master = branch.get_master_branch()
120
local_extra, remote_extra = find_unmerged(b, b.get_master_branch())
195
local_extra, remote_extra = find_unmerged(branch, master)
122
197
print 'Branch is out of date: missing %d revision%s.' % (
123
198
len(remote_extra), plural(len(remote_extra)))
161
236
print ' %8d revision%s' % (revno, plural(revno))
163
238
for rev in history:
164
committers[b.repository.get_revision(rev).committer] = True
239
committers[branch.repository.get_revision(rev).committer] = True
165
240
print ' %8d committer%s' % (len(committers), plural(len(committers)))
167
firstrev = b.repository.get_revision(history[0])
242
firstrev = branch.repository.get_revision(history[0])
168
243
age = int((time.time() - firstrev.timestamp) / 3600 / 24)
169
244
print ' %8d day%s old' % (age, plural(age))
170
245
print ' first revision: %s' % format_date(firstrev.timestamp,
171
246
firstrev.timezone)
173
lastrev = b.repository.get_revision(history[-1])
248
lastrev = branch.repository.get_revision(history[-1])
174
249
print ' latest revision: %s' % format_date(lastrev.timestamp,
175
250
lastrev.timezone)
178
253
# print 'text store:'
179
# c, t = b.text_store.total_size()
254
# c, t = branch.text_store.total_size()
180
255
# print ' %8d file texts' % c
181
256
# print ' %8d kB' % (t/1024)
184
259
print 'revision store:'
185
c, t = b.repository._revision_store.total_size(b.repository.get_transaction())
260
c, t = branch.repository._revision_store.total_size(branch.repository.get_transaction())
186
261
print ' %8d revision%s' % (c, plural(c))
187
262
print ' %8d kB' % (t/1024)
191
265
# print 'inventory store:'
192
# c, t = b.inventory_store.total_size()
266
# c, t = branch.inventory_store.total_size()
193
267
# print ' %8d inventories' % c
194
268
# print ' %8d kB' % (t/1024)
199
print 'parent location:'