25
25
from bzrlib.log import line_log
26
26
from bzrlib.osutils import is_inside_any
27
27
from bzrlib.symbol_versioning import (deprecated_function,
29
30
from bzrlib.trace import warning
32
33
# if known, but only if really going to the terminal (not into a file)
36
@deprecated_function(zero_eight)
37
def show_status(branch, show_unchanged=None,
43
"""Display summary of changes.
45
Please use show_tree_status instead.
47
By default this compares the working tree to a previous revision.
48
If the revision argument is given, summarizes changes between the
49
working tree and another, or between two revisions.
51
The result is written out as Unicode and to_file should be able
55
If set, includes unchanged files.
58
If set, only show the status of files in this list.
61
If set, includes each file's id.
64
If set, write to this file (default stdout.)
67
If set, write pending merges.
70
If None the compare latest revision with working tree
71
If one revision show compared it with working tree.
72
If two revisions show status between first and second.
74
show_tree_status(branch.bzrdir.open_workingtree(), show_unchanged,
75
specific_files, show_ids, to_file, show_pending, revision)
35
78
def show_tree_status(wt, show_unchanged=None,
36
79
specific_files=None,
84
127
old = new.basis_tree()
85
128
elif len(revision) > 0:
87
rev_id = revision[0].as_revision_id(wt.branch)
130
rev_id = revision[0].in_history(wt.branch).rev_id
88
131
old = wt.branch.repository.revision_tree(rev_id)
89
132
except errors.NoSuchRevision, e:
90
133
raise errors.BzrCommandError(str(e))
91
134
if (len(revision) > 1) and (revision[1].spec is not None):
93
rev_id = revision[1].as_revision_id(wt.branch)
136
rev_id = revision[1].in_history(wt.branch).rev_id
94
137
new = wt.branch.repository.revision_tree(rev_id)
95
138
new_is_working_tree = False
96
139
except errors.NoSuchRevision, e:
103
146
_raise_if_nonexistent(specific_files, old, new)
104
147
want_unversioned = not versioned
106
changes = new.iter_changes(old, show_unchanged, specific_files,
149
changes = new._iter_changes(old, show_unchanged, specific_files,
107
150
require_versioned=False, want_unversioned=want_unversioned)
108
151
reporter = _mod_delta._ChangeReporter(output_file=to_file,
109
152
unversioned_filter=new.is_ignored)
120
163
show_ids=show_ids,
121
164
show_unchanged=show_unchanged,
122
165
short_status=False)
123
# show the new conflicts only for now. XXX: get them from the
125
conflicts = new.conflicts()
126
if specific_files is not None:
127
conflicts = conflicts.select_conflicts(new, specific_files,
128
ignore_misses=True, recurse=True)[1]
129
if len(conflicts) > 0 and not short:
130
to_file.write("conflicts:\n")
131
for conflict in conflicts:
166
conflict_title = False
167
# show the new conflicts only for now. XXX: get them from the delta.
168
for conflict in new.conflicts():
169
if not short and conflict_title is False:
170
print >> to_file, "conflicts:"
171
conflict_title = True
136
to_file.write("%s %s\n" % (prefix, conflict))
137
if (new_is_working_tree and show_pending
138
and specific_files is None):
176
print >> to_file, "%s %s" % (prefix, conflict)
177
if new_is_working_tree and show_pending:
139
178
show_pending_merges(new, to_file, short)
152
191
branch = new.branch
153
192
last_revision = parents[0]
155
to_file.write('pending merges:\n')
194
print >>to_file, 'pending merges:'
156
195
if last_revision is not None:
158
ignore = set(branch.repository.get_ancestry(last_revision,
197
ignore = set(branch.repository.get_ancestry(last_revision))
160
198
except errors.NoSuchRevision:
161
199
# the last revision is a ghost : assume everything is new
169
207
ignore.add(merge)
171
209
from bzrlib.osutils import terminal_width
172
width = terminal_width() - 1 # we need one extra space to avoid
210
width = terminal_width()
174
211
m_revision = branch.repository.get_revision(merge)
179
to_file.write(prefix)
180
to_file.write(line_log(m_revision, width - len(prefix)))
216
print >> to_file, prefix, line_log(m_revision, width - 4)
182
217
inner_merges = branch.repository.get_ancestry(merge)
183
218
assert inner_merges[0] is None
184
219
inner_merges.pop(0)
189
224
mm_revision = branch.repository.get_revision(mmerge)
194
to_file.write(prefix)
195
to_file.write(line_log(mm_revision, width - len(prefix)))
229
print >> to_file, prefix, line_log(mm_revision, width - 5)
197
230
ignore.add(mmerge)
198
231
except errors.NoSuchRevision:
203
to_file.write(prefix + ' ' + merge)
236
print >> to_file, prefix, merge