~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

[merge] up-to-date against bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
# TODO: Show which revision caused a line to merge into the parent
24
24
 
25
 
# TODO: With --long, show entire email address, not just the first bit
26
 
 
27
25
# TODO: perhaps abbreviate timescales depending on how recent they are
28
26
# e.g. "3:12 Tue", "13 Oct", "Oct 2005", etc.  
29
27
 
33
31
 
34
32
import bzrlib.weave
35
33
from bzrlib.config import extract_email_address
 
34
from bzrlib.errors import BzrError
36
35
 
37
36
 
38
37
def annotate_file(branch, rev_id, file_id, verbose=False, full=False,
41
40
        to_file = sys.stdout
42
41
 
43
42
    prevanno=''
44
 
    for (revno_str, author, date_str, line_rev_id, text ) in \
45
 
            _annotate_file(branch, rev_id, file_id ):
46
 
 
 
43
    annotation = list(_annotate_file(branch, rev_id, file_id))
 
44
    max_origin_len = max(len(origin) for origin in set(x[1] for x in annotation))
 
45
    for (revno_str, author, date_str, line_rev_id, text ) in annotation:
47
46
        if verbose:
48
 
            anno = '%5s %-12s %8s ' % (revno_str, author[:12], date_str)
 
47
            anno = '%5s %-*s %8s ' % (revno_str, max_origin_len, author, date_str)
49
48
        else:
50
49
            anno = "%5s %-7s " % ( revno_str, author[:7] )
51
50