53
53
from bzrlib.tree import EmptyTree
54
54
from bzrlib.delta import compare_trees
55
55
from bzrlib.trace import mutter
56
from bzrlib.errors import InvalidRevisionNumber
58
59
def find_touching_revisions(branch, file_id):
151
which_revs = branch.enum_history(direction)
152
which_revs = [x for x in which_revs if (
153
(start_revision is None or x[0] >= start_revision)
154
and (end_revision is None or x[0] <= end_revision))]
156
if not (verbose or specific_fileid):
157
# no need to know what changed between revisions
158
with_deltas = deltas_for_log_dummy(branch, which_revs)
159
elif direction == 'reverse':
160
with_deltas = deltas_for_log_reverse(branch, which_revs)
162
with_deltas = deltas_for_log_forward(branch, which_revs)
164
for revno, rev, delta in with_deltas:
161
which_revs = _enumerate_history(branch)
163
if start_revision is None:
165
elif start_revision < 1 or start_revision >= len(which_revs):
166
raise InvalidRevisionNumber(start_revision)
168
if end_revision is None:
169
end_revision = len(which_revs)
170
elif end_revision < 1 or end_revision >= len(which_revs):
171
raise InvalidRevisionNumber(end_revision)
173
# list indexes are 0-based; revisions are 1-based
174
cut_revs = which_revs[(start_revision-1):(end_revision)]
176
if direction == 'reverse':
178
elif direction == 'forward':
181
raise ValueError('invalid direction %r' % direction)
183
for revno, rev_id in cut_revs:
184
if verbose or specific_fileid:
185
delta = branch.get_revision_delta(revno)
165
187
if specific_fileid:
166
188
if not delta.touches_file_id(specific_fileid):
170
192
# although we calculated it, throw it away without display
173
if searchRE is None or searchRE.search(rev.message):
174
lf.show(revno, rev, delta)
195
rev = branch.get_revision(rev_id)
198
if not searchRE.search(rev.message):
201
lf.show(revno, rev, delta)