18
18
from bzrlib.osutils import is_inside_any
19
19
from bzrlib.delta import compare_trees
20
from bzrlib.log import line_log
21
from bzrlib.errors import NoSuchRevision
23
# TODO: when showing single-line logs, truncate to the width of the terminal
24
# if known, but only if really going to the terminal (not into a file)
22
27
def show_status(branch, show_unchanged=False,
28
"""Display status for non-ignored working files.
33
"""Display summary of changes.
35
By default this compares the working tree to a previous revision.
36
If the revision argument is given, summarizes changes between the
37
working tree and another, or between two revisions.
39
The result is written out as Unicode and to_file should be able
31
43
If set, includes unchanged files.
81
93
show_unchanged=show_unchanged)
83
95
if new_is_working_tree:
84
conflicts = new.iter_conflicts()
85
unknowns = new.unknowns()
86
list_paths('unknown', unknowns, specific_files, to_file)
87
list_paths('conflicts', conflicts, specific_files, to_file)
88
if show_pending and len(branch.pending_merges()) > 0:
89
print >>to_file, 'pending merges:'
90
for merge in branch.pending_merges():
91
print >> to_file, ' ', merge
96
list_paths('unknown', new.unknowns(), specific_files, to_file)
97
list_paths('conflicts', new.iter_conflicts(), specific_files, to_file)
98
if new_is_working_tree and show_pending:
99
show_pending_merges(new, to_file)
103
def show_pending_merges(new, to_file):
104
"""Write out a display of pending merges in a working tree."""
105
pending = new.pending_merges()
107
if len(pending) == 0:
109
print >>to_file, 'pending merges:'
110
last_revision = branch.last_revision()
111
if last_revision is not None:
112
ignore = set(branch.get_ancestry(last_revision))
115
for merge in new.pending_merges():
118
m_revision = branch.get_revision(merge)
119
print >> to_file, ' ', line_log(m_revision, 77)
120
inner_merges = branch.get_ancestry(merge)
121
inner_merges.reverse()
122
for mmerge in inner_merges:
125
mm_revision = branch.get_revision(mmerge)
126
print >> to_file, ' ', line_log(mm_revision, 75)
128
except NoSuchRevision:
129
print >> to_file, ' ', merge
95
131
def list_paths(header, paths, specific_files, to_file):
96
132
done_header = False