/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: Adeodato Simó
  • Date: 2007-07-06 17:21:57 UTC
  • mto: (2593.2.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 2594.
  • Revision ID: dato@net.com.org.es-20070706172157-11w04axiv4mtrabm
Improve annotate to prevent unicode exceptions in certain situations.

The fixed bugs are:

  * when an annotation has the author part as unicode(), and line
    contents are 8-bit data, an UnicodeDecodeError is raised when
    formatting them together with '%s %s'

  * when the author part of an annotation contains characters not
    representable in the encoding of the user that runs annotate,
    an UnicodeEncodeError is raised

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
            anno = "%-*s %-7s " % (max_revno_len, revno_str, author[:7])
80
80
 
81
81
        if anno.lstrip() == "" and full: anno = prevanno
82
 
        print >>to_file, '%s| %s' % (anno, text)
 
82
        try:
 
83
            to_file.write(anno)
 
84
        except UnicodeEncodeError:
 
85
            to_file.write(anno.encode(to_file.encoding, 'replace'))
 
86
        print >>to_file, '| %s' % (text,)
83
87
        prevanno=anno
84
88
 
85
89