/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/annotate.py

  • Committer: John Arbash Meinel
  • Date: 2006-12-13 22:23:27 UTC
  • mto: This revision was merged to the branch mainline in revision 2186.
  • Revision ID: john@arbash-meinel.com-20061213222327-qikhtcopbp1mf5hg
add show-ids and test that nearby areas are collapsed without full

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    prevanno=''
44
44
    annotation = list(_annotate_file(branch, rev_id, file_id))
45
45
    if len(annotation) == 0:
46
 
        max_origin_len = 0
47
 
        max_revno_len = 0
 
46
        max_origin_len = max_revno_len = max_revid_len = 0
48
47
    else:
49
48
        max_origin_len = max(len(origin) for origin in set(x[1] for x in annotation))
50
49
        max_revno_len = max(len(x[0]) for x in annotation)
 
50
        max_revid_len = max(len(x[3]) for x in annotation)
51
51
 
52
52
    if not verbose:
53
53
        max_revno_len = max(min(max_revno_len, 12), 3)
54
54
 
55
 
    for (revno_str, author, date_str, line_rev_id, text ) in annotation:
56
 
        if verbose:
57
 
            anno = '%-*s %-*s %8s ' % (max_revno_len, revno_str, max_origin_len, author, date_str)
 
55
    last_rev_id = None
 
56
    for (revno_str, author, date_str, line_rev_id, text) in annotation:
 
57
        if show_ids:
 
58
            if full or last_rev_id != line_rev_id:
 
59
                anno = '%*s ' % (max_revid_len, str(line_rev_id))
 
60
            else:
 
61
                anno = ' ' * (max_revid_len+1)
 
62
            last_rev_id = line_rev_id
58
63
        else:
59
 
            if len(revno_str) > max_revno_len:
60
 
                revno_str = revno_str[:max_revno_len-1] + '>'
61
 
            anno = "%-*s %-7s " % (max_revno_len, revno_str, author[:7] )
 
64
            if verbose:
 
65
                anno = '%-*s %-*s %8s ' % (max_revno_len, revno_str, max_origin_len, author, date_str)
 
66
            else:
 
67
                if len(revno_str) > max_revno_len:
 
68
                    revno_str = revno_str[:max_revno_len-1] + '>'
 
69
                anno = "%-*s %-7s " % (max_revno_len, revno_str, author[:7] )
62
70
 
63
71
        if anno.lstrip() == "" and full: anno = prevanno
64
72
        print >>to_file, '%s| %s' % (anno, text)