124
125
if specific_fileid:
125
126
mutter('get log for file_id %r' % specific_fileid)
128
if search is not None:
130
searchRE = re.compile(search, re.IGNORECASE)
127
134
which_revs = branch.enum_history(direction)
135
which_revs = [x for x in which_revs if (
136
(start_revision is None or x[0] >= start_revision)
137
and (end_revision is None or x[0] <= end_revision))]
129
139
if not (verbose or specific_fileid):
130
140
# no need to know what changed between revisions
132
142
elif direction == 'reverse':
133
143
with_deltas = deltas_for_log_reverse(branch, which_revs)
135
raise NotImplementedError("sorry, verbose forward logs not done yet")
145
with_deltas = deltas_for_log_forward(branch, which_revs)
137
147
for revno, rev, delta in with_deltas:
138
148
if specific_fileid:
139
149
if not delta.touches_file_id(specific_fileid):
142
if start_revision is not None and revno < start_revision:
145
if end_revision is not None and revno > end_revision:
149
153
# although we calculated it, throw it away without display
152
lf.show(revno, rev, delta)
156
if searchRE is None or searchRE.search(rev.message):
157
lf.show(revno, rev, delta)
180
185
yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
187
this_tree = EmptyTree(branch.get_root_id())
182
189
last_revno = revno
183
190
last_revision = this_revision
184
191
last_tree = this_tree
187
this_tree = EmptyTree()
195
this_tree = EmptyTree(branch.get_root_id())
197
this_revno = last_revno - 1
198
this_revision_id = branch.revision_history()[this_revno]
199
this_tree = branch.revision_tree(this_revision_id)
188
200
yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
203
def deltas_for_log_forward(branch, which_revs):
204
"""Compute deltas for display in forward log.
206
Given a sequence of (revno, revision_id) pairs, return
209
The delta is from the given revision to the next one in the
210
sequence, which makes sense if the log is being displayed from
213
from tree import EmptyTree
214
from diff import compare_trees
216
last_revno = last_revision_id = last_tree = None
217
prev_tree = EmptyTree(branch.get_root_id())
219
for revno, revision_id in which_revs:
220
this_tree = branch.revision_tree(revision_id)
221
this_revision = branch.get_revision(revision_id)
225
last_tree = EmptyTree(branch.get_root_id())
227
last_revno = revno - 1
228
last_revision_id = branch.revision_history()[last_revno]
229
last_tree = branch.revision_tree(last_revision_id)
231
yield revno, this_revision, compare_trees(last_tree, this_tree, False)
234
last_revision = this_revision
235
last_tree = this_tree
193
238
class LogFormatter(object):