/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: Aaron Bentley
  • Date: 2006-11-17 04:06:03 UTC
  • mfrom: (2139 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2162.
  • Revision ID: aaron.bentley@utoronto.ca-20061117040603-pgebxndswvwk26tt
Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005 by Canonical Ltd
2
 
 
 
1
# Copyright (C) 2004, 2005 Canonical Ltd
 
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
5
5
# the Free Software Foundation; either version 2 of the License, or
6
6
# (at your option) any later version.
7
 
 
 
7
#
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
11
# GNU General Public License for more details.
12
 
 
 
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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)