125
124
if specific_fileid:
126
125
mutter('get log for file_id %r' % specific_fileid)
128
if search is not None:
130
searchRE = re.compile(search, re.IGNORECASE)
134
127
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))]
139
129
if not (verbose or specific_fileid):
140
130
# no need to know what changed between revisions
142
132
elif direction == 'reverse':
143
133
with_deltas = deltas_for_log_reverse(branch, which_revs)
145
with_deltas = deltas_for_log_forward(branch, which_revs)
135
raise NotImplementedError("sorry, verbose forward logs not done yet")
147
137
for revno, rev, delta in with_deltas:
148
138
if specific_fileid:
149
139
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:
153
149
# although we calculated it, throw it away without display
156
if searchRE is None or searchRE.search(rev.message):
157
lf.show(revno, rev, delta)
152
lf.show(revno, rev, delta)
185
180
yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
187
this_tree = EmptyTree(branch.get_root_id())
189
182
last_revno = revno
190
183
last_revision = this_revision
191
184
last_tree = this_tree
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)
187
this_tree = EmptyTree()
200
188
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
238
193
class LogFormatter(object):