~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/annotate.py

Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
import time
30
30
 
31
31
from bzrlib.config import extract_email_address
32
 
from bzrlib.errors import BzrError
 
32
from bzrlib.errors import NoEmailInUsername
33
33
 
34
34
 
35
35
def annotate_file(branch, rev_id, file_id, verbose=False, full=False,
39
39
 
40
40
    prevanno=''
41
41
    annotation = list(_annotate_file(branch, rev_id, file_id))
42
 
    max_origin_len = max(len(origin) for origin in set(x[1] for x in annotation))
 
42
    if len(annotation) == 0:
 
43
        max_origin_len = 0
 
44
    else:
 
45
        max_origin_len = max(len(origin) for origin in set(x[1] for x in annotation))
43
46
    for (revno_str, author, date_str, line_rev_id, text ) in annotation:
44
47
        if verbose:
45
48
            anno = '%5s %-*s %8s ' % (revno_str, max_origin_len, author, date_str)
78
81
            author = rev.committer
79
82
            try:
80
83
                author = extract_email_address(author)
81
 
            except BzrError:
 
84
            except NoEmailInUsername:
82
85
                pass        # use the whole name
83
86
        yield (revno_str, author, date_str, origin, text)