/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Aaron Bentley
  • Date: 2006-06-21 13:37:30 UTC
  • mfrom: (1799 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1802.
  • Revision ID: abentley@panoramicfeedback.com-20060621133730-6f6f965f4d2e3743
Merge bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
all the changes since the previous revision that touched hello.c.
50
50
"""
51
51
 
52
 
 
53
52
# TODO: option to show delta summaries for merged-in revisions
 
53
 
54
54
from itertools import izip
55
55
import re
56
56
 
272
272
            lf.show_merge(rev, merge_depth)
273
273
 
274
274
 
275
 
def deltas_for_log_dummy(branch, which_revs):
276
 
    """Return all the revisions without intermediate deltas.
277
 
 
278
 
    Useful for log commands that won't need the delta information.
279
 
    """
280
 
    
281
 
    for revno, revision_id in which_revs:
282
 
        yield revno, branch.get_revision(revision_id), None
283
 
 
284
 
 
285
 
def deltas_for_log_reverse(branch, which_revs):
286
 
    """Compute deltas for display in latest-to-earliest order.
287
 
 
288
 
    branch
289
 
        Branch to traverse
290
 
 
291
 
    which_revs
292
 
        Sequence of (revno, revision_id) for the subset of history to examine
293
 
 
294
 
    returns 
295
 
        Sequence of (revno, rev, delta)
296
 
 
297
 
    The delta is from the given revision to the next one in the
298
 
    sequence, which makes sense if the log is being displayed from
299
 
    newest to oldest.
300
 
    """
301
 
    last_revno = last_revision_id = last_tree = None
302
 
    for revno, revision_id in which_revs:
303
 
        this_tree = branch.revision_tree(revision_id)
304
 
        this_revision = branch.get_revision(revision_id)
305
 
        
306
 
        if last_revno:
307
 
            yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
308
 
 
309
 
        this_tree = EmptyTree(branch.get_root_id())
310
 
 
311
 
        last_revno = revno
312
 
        last_revision = this_revision
313
 
        last_tree = this_tree
314
 
 
315
 
    if last_revno:
316
 
        if last_revno == 1:
317
 
            this_tree = EmptyTree(branch.get_root_id())
318
 
        else:
319
 
            this_revno = last_revno - 1
320
 
            this_revision_id = branch.revision_history()[this_revno]
321
 
            this_tree = branch.revision_tree(this_revision_id)
322
 
        yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
323
 
 
324
 
 
325
 
def deltas_for_log_forward(branch, which_revs):
326
 
    """Compute deltas for display in forward log.
327
 
 
328
 
    Given a sequence of (revno, revision_id) pairs, return
329
 
    (revno, rev, delta).
330
 
 
331
 
    The delta is from the given revision to the next one in the
332
 
    sequence, which makes sense if the log is being displayed from
333
 
    newest to oldest.
334
 
    """
335
 
    last_revno = last_revision_id = last_tree = None
336
 
    prev_tree = EmptyTree(branch.get_root_id())
337
 
 
338
 
    for revno, revision_id in which_revs:
339
 
        this_tree = branch.revision_tree(revision_id)
340
 
        this_revision = branch.get_revision(revision_id)
341
 
 
342
 
        if not last_revno:
343
 
            if revno == 1:
344
 
                last_tree = EmptyTree(branch.get_root_id())
345
 
            else:
346
 
                last_revno = revno - 1
347
 
                last_revision_id = branch.revision_history()[last_revno]
348
 
                last_tree = branch.revision_tree(last_revision_id)
349
 
 
350
 
        yield revno, this_revision, compare_trees(last_tree, this_tree, False)
351
 
 
352
 
        last_revno = revno
353
 
        last_revision = this_revision
354
 
        last_tree = this_tree
355
 
 
356
 
 
357
275
class LogFormatter(object):
358
276
    """Abstract class to display log messages."""
359
277