/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-23 15:27:25 UTC
  • mfrom: (1806 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1807.
  • Revision ID: abentley@panoramicfeedback.com-20060623152725-61519496365d39fc
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
 
292
292
        yield rev_id, rev_nos.get(rev_id), merge_depth
293
293
 
294
294
 
295
 
def deltas_for_log_dummy(branch, which_revs):
296
 
    """Return all the revisions without intermediate deltas.
297
 
 
298
 
    Useful for log commands that won't need the delta information.
299
 
    """
300
 
    
301
 
    for revno, revision_id in which_revs:
302
 
        yield revno, branch.get_revision(revision_id), None
303
 
 
304
 
 
305
 
def deltas_for_log_reverse(branch, which_revs):
306
 
    """Compute deltas for display in latest-to-earliest order.
307
 
 
308
 
    branch
309
 
        Branch to traverse
310
 
 
311
 
    which_revs
312
 
        Sequence of (revno, revision_id) for the subset of history to examine
313
 
 
314
 
    returns 
315
 
        Sequence of (revno, rev, delta)
316
 
 
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
319
 
    newest to oldest.
320
 
    """
321
 
    last_revno = last_revision_id = last_tree = None
322
 
    for revno, revision_id in which_revs:
323
 
        this_tree = branch.revision_tree(revision_id)
324
 
        this_revision = branch.get_revision(revision_id)
325
 
        
326
 
        if last_revno:
327
 
            yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
328
 
 
329
 
        this_tree = EmptyTree(branch.get_root_id())
330
 
 
331
 
        last_revno = revno
332
 
        last_revision = this_revision
333
 
        last_tree = this_tree
334
 
 
335
 
    if last_revno:
336
 
        if last_revno == 1:
337
 
            this_tree = EmptyTree(branch.get_root_id())
338
 
        else:
339
 
            this_revno = last_revno - 1
340
 
            this_revision_id = branch.revision_history()[this_revno]
341
 
            this_tree = branch.revision_tree(this_revision_id)
342
 
        yield last_revno, last_revision, compare_trees(this_tree, last_tree, False)
343
 
 
344
 
 
345
 
def deltas_for_log_forward(branch, which_revs):
346
 
    """Compute deltas for display in forward log.
347
 
 
348
 
    Given a sequence of (revno, revision_id) pairs, return
349
 
    (revno, rev, delta).
350
 
 
351
 
    The delta is from the given revision to the next one in the
352
 
    sequence, which makes sense if the log is being displayed from
353
 
    newest to oldest.
354
 
    """
355
 
    last_revno = last_revision_id = last_tree = None
356
 
    prev_tree = EmptyTree(branch.get_root_id())
357
 
 
358
 
    for revno, revision_id in which_revs:
359
 
        this_tree = branch.revision_tree(revision_id)
360
 
        this_revision = branch.get_revision(revision_id)
361
 
 
362
 
        if not last_revno:
363
 
            if revno == 1:
364
 
                last_tree = EmptyTree(branch.get_root_id())
365
 
            else:
366
 
                last_revno = revno - 1
367
 
                last_revision_id = branch.revision_history()[last_revno]
368
 
                last_tree = branch.revision_tree(last_revision_id)
369
 
 
370
 
        yield revno, this_revision, compare_trees(last_tree, this_tree, False)
371
 
 
372
 
        last_revno = revno
373
 
        last_revision = this_revision
374
 
        last_tree = this_tree
375
 
 
376
 
 
377
295
class LogFormatter(object):
378
296
    """Abstract class to display log messages."""
379
297