~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/log.py

  • Committer: Aaron Bentley
  • Date: 2006-06-23 16:26:25 UTC
  • mto: This revision was merged to the branch mainline in revision 1810.
  • Revision ID: abentley@panoramicfeedback.com-20060623162625-6b87b9ec194d9053
Forward sorting shows merges under mainline revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
282
282
 
283
283
    if direction == 'forward':
284
284
        # forward means oldest first.
285
 
        merge_sorted_revisions.reverse()
 
285
        merge_sorted_revisions = reverse_zero_depth(merge_sorted_revisions)
286
286
    elif direction != 'reverse':
287
287
        raise ValueError('invalid direction %r' % direction)
288
288
 
292
292
        yield rev_id, rev_nos.get(rev_id), merge_depth
293
293
 
294
294
 
 
295
def reverse_zero_depth(merge_sorted_revisions):
 
296
    """Reverse zero-depth revisions.
 
297
 
 
298
    Revisions with a depth > 0 are sorted as a group with the previous i
 
299
    zero-depth revision.  There may be no topological justification for this,
 
300
    but it looks much nicer.
 
301
    """
 
302
    zd_revisions = []
 
303
    for val in merge_sorted_revisions:
 
304
        if val[2] == 0:
 
305
            zd_revisions.append([val])
 
306
        else:
 
307
            zd_revisions[-1].append(val)
 
308
    zd_revisions.reverse()
 
309
    result = []
 
310
    for chunk in zd_revisions:
 
311
        result.extend(chunk)
 
312
    return result
 
313
 
 
314
 
295
315
class LogFormatter(object):
296
316
    """Abstract class to display log messages."""
297
317