1978
1978
:Path filtering:
1980
If a parameter is given and it's not a branch, the log will be filtered
1981
to show only those revisions that changed the nominated file or
1980
If parameters are given and the first one is not a branch, the log
1981
will be filtered to show only those revisions that changed the
1982
nominated files or directories.
1984
1984
Filenames are interpreted within their historical context. To log a
1985
1985
deleted file, specify a revision range so that the file existed at
2008
2008
explicitly ask for this (and no way to stop logging a file back
2009
2009
until it was last renamed).
2011
Note: If the path is a directory, only revisions that directly changed
2012
that directory object are currently shown. This is considered a bug.
2013
(Support for filtering against multiple files and for files within a
2014
directory is under development.)
2016
2011
:Other filtering:
2018
2013
The --message option can be used for finding revisions that match a
2063
2058
the revnocache plugin. This plugin buffers historical information
2064
2059
trading disk space for faster speed.
2066
takes_args = ['location?']
2061
takes_args = ['file*']
2067
2062
_see_also = ['log-formats', 'revisionspec']
2068
2063
takes_options = [
2069
2064
Option('forward',
2101
2096
encoding_type = 'replace'
2103
2098
@display_command
2104
def run(self, location=None, timezone='original',
2099
def run(self, file_list=None, timezone='original',
2106
2101
show_ids=False,
2125
2124
revision = change
2130
# find the file id to log:
2132
tree, b, fp = bzrdir.BzrDir.open_containing_tree_or_branch(
2135
file_id = _get_fileid_to_log(revision, tree, b, fp)
2127
filter_by_dir = False
2129
# find the file ids to log and check for directory filtering
2130
b, file_info_list, rev1, rev2 = _get_info_for_log_files(revision,
2132
for relpath, file_id, kind in file_info_list:
2136
2133
if file_id is None:
2137
2134
raise errors.BzrCommandError(
2138
2135
"Path unknown at end or start of revision range: %s" %
2137
# If the relpath is the top of the tree, we log everything
2142
file_ids.append(file_id)
2143
filter_by_dir = filter_by_dir or (
2144
kind in ['directory', 'tree-reference'])
2142
2147
# FIXME ? log the current subdir only RBC 20060203
2143
2148
if revision is not None \
2144
2149
and len(revision) > 0 and revision[0].get_branch():
2148
2153
dir, relpath = bzrdir.BzrDir.open_containing(location)
2149
2154
b = dir.open_branch()
2153
2155
rev1, rev2 = _get_revision_range(revision, b, self.name())
2157
# Decide on the type of delta & diff filtering to use
2158
# TODO: add an --all-files option to make this configurable & consistent
2166
diff_type = 'partial'
2172
# Build the log formatter
2154
2173
if log_format is None:
2155
2174
log_format = log.log_formatter_registry.get_default(b)
2157
2175
lf = log_format(show_ids=show_ids, to_file=self.outf,
2158
2176
show_timezone=timezone,
2159
2177
delta_format=get_verbosity_level(),
2166
direction=direction,
2167
start_revision=rev1,
2171
show_diff=show_diff)
2180
# Choose the algorithm for doing the logging. It's annoying
2181
# having multiple code paths like this but necessary until
2182
# the underlying repository format is faster at generating
2183
# deltas or can provide everything we need from the indices.
2184
# The default algorithm - match-using-deltas - works for
2185
# multiple files and directories and is faster for small
2186
# amounts of history (200 revisions say). However, it's too
2187
# slow for logging a single file in a repository with deep
2188
# history, i.e. > 10K revisions. In the spirit of "do no
2189
# evil when adding features", we continue to use the
2190
# original algorithm - per-file-graph - for the "single
2191
# file that isn't a directory without showing a delta" case.
2192
match_using_deltas = (len(file_ids) != 1 or filter_by_dir
2195
# Build the LogRequest and execute it
2196
if len(file_ids) == 0:
2198
rqst = make_log_request_dict(
2199
direction=direction, specific_fileids=file_ids,
2200
start_revision=rev1, end_revision=rev2, limit=limit,
2201
message_search=message, delta_type=delta_type,
2202
diff_type=diff_type, _match_using_deltas=match_using_deltas)
2203
Logger(b, rqst).show(lf)
2177
2209
"""Take the input of a revision option and turn it into a revision range.
2179
2211
It returns RevisionInfo objects which can be used to obtain the rev_id's
2180
of the desired revisons. It does some user input validations.
2212
of the desired revisions. It does some user input validations.
2182
2214
if revisionspec_list is None: