20
20
from bzrlib.errors import NoSuchRevision
21
21
from bzrlib.log import line_log
22
22
from bzrlib.osutils import is_inside_any
23
from bzrlib.symbol_versioning import *
24
25
# TODO: when showing single-line logs, truncate to the width of the terminal
25
26
# if known, but only if really going to the terminal (not into a file)
29
@deprecated_function(zero_eight)
28
30
def show_status(branch, show_unchanged=False,
29
31
specific_files=None,
60
62
If one revision show compared it with working tree.
61
63
If two revisions show status between first and second.
65
show_tree_status(branch.bzrdir.open_workingtree(), show_unchanged,
66
specific_files, show_ids, to_file, show_pending, revision)
68
def show_tree_status(wt, show_unchanged=False,
74
"""Display summary of changes.
76
By default this compares the working tree to a previous revision.
77
If the revision argument is given, summarizes changes between the
78
working tree and another, or between two revisions.
80
The result is written out as Unicode and to_file should be able
84
If set, includes unchanged files.
87
If set, only show the status of files in this list.
90
If set, includes each file's id.
93
If set, write to this file (default stdout.)
96
If set, write pending merges.
99
If None the compare latest revision with working tree
100
If one revision show compared it with working tree.
101
If two revisions show status between first and second.
63
103
if to_file == None:
64
104
to_file = sys.stdout
68
108
new_is_working_tree = True
69
109
if revision is None:
70
new = branch.bzrdir.open_workingtree()
71
111
old = new.basis_tree()
72
112
elif len(revision) > 0:
74
rev_id = revision[0].in_history(branch).rev_id
75
old = branch.repository.revision_tree(rev_id)
114
rev_id = revision[0].in_history(wt.branch).rev_id
115
old = wt.branch.repository.revision_tree(rev_id)
76
116
except NoSuchRevision, e:
77
117
raise BzrCommandError(str(e))
78
118
if (len(revision) > 1) and (revision[1].spec is not None):
80
rev_id = revision[1].in_history(branch).rev_id
81
new = branch.repository.revision_tree(rev_id)
120
rev_id = revision[1].in_history(wt.branch).rev_id
121
new = wt.branch.repository.revision_tree(rev_id)
82
122
new_is_working_tree = False
83
123
except NoSuchRevision, e:
84
124
raise BzrCommandError(str(e))
86
new = branch.bzrdir.open_workingtree()
88
128
delta = compare_trees(old, new, want_unchanged=show_unchanged,
89
129
specific_files=specific_files)