232
233
for index, rev_id in cut_revs:
233
234
rev_nos[rev_id] = index
236
def iter_revisions():
237
revision_ids = [r for s, r, m, e in merge_sorted_revisions]
240
revisions = branch.repository.get_revisions(revision_ids[:num])
241
for revision in revisions:
243
revision_ids = revision_ids[num:]
246
revisions = branch.repository.get_revisions()
247
for revision in revisions:
235
249
# now we just print all the revisions
236
for sequence, rev_id, merge_depth, end_of_merge in merge_sorted_revisions:
237
rev = branch.repository.get_revision(rev_id)
250
for ((sequence, rev_id, merge_depth, end_of_merge), rev) in \
251
izip(merge_sorted_revisions, iter_revisions()):
240
254
if not searchRE.search(rev.message):
258
272
lf.show_merge(rev, merge_depth)
261
def deltas_for_log_dummy(branch, which_revs):
262
"""Return all the revisions without intermediate deltas.
264
Useful for log commands that won't need the delta information.
267
for revno, revision_id in which_revs:
268
yield revno, branch.get_revision(revision_id), None
271
def deltas_for_log_reverse(branch, which_revs):
272
"""Compute deltas for display in latest-to-earliest order.
278
Sequence of (revno, revision_id) for the subset of history to examine
281
Sequence of (revno, rev, delta)
283
The delta is from the given revision to the next one in the
284
sequence, which makes sense if the log is being displayed from
287
last_revno = last_revision_id = last_tree = None
288
for revno, revision_id in which_revs:
289
this_tree = branch.revision_tree(revision_id)
290
this_revision = branch.get_revision(revision_id)
293
yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
295
this_tree = EmptyTree(branch.get_root_id())
298
last_revision = this_revision
299
last_tree = this_tree
303
this_tree = EmptyTree(branch.get_root_id())
305
this_revno = last_revno - 1
306
this_revision_id = branch.revision_history()[this_revno]
307
this_tree = branch.revision_tree(this_revision_id)
308
yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
311
def deltas_for_log_forward(branch, which_revs):
312
"""Compute deltas for display in forward log.
314
Given a sequence of (revno, revision_id) pairs, return
317
The delta is from the given revision to the next one in the
318
sequence, which makes sense if the log is being displayed from
321
last_revno = last_revision_id = last_tree = None
322
prev_tree = EmptyTree(branch.get_root_id())
324
for revno, revision_id in which_revs:
325
this_tree = branch.revision_tree(revision_id)
326
this_revision = branch.get_revision(revision_id)
330
last_tree = EmptyTree(branch.get_root_id())
332
last_revno = revno - 1
333
last_revision_id = branch.revision_history()[last_revno]
334
last_tree = branch.revision_tree(last_revision_id)
336
yield revno, this_revision, compare_trees(last_tree, this_tree, False)
339
last_revision = this_revision
340
last_tree = this_tree
343
275
class LogFormatter(object):
344
276
"""Abstract class to display log messages."""
491
423
raise BzrCommandError("unknown log formatter: %r" % name)
493
425
def show_one_log(revno, rev, delta, verbose, to_file, show_timezone):
494
# deprecated; for compatability
426
# deprecated; for compatibility
495
427
lf = LongLogFormatter(to_file=to_file, show_timezone=show_timezone)
496
428
lf.show(revno, rev, delta)