/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: Vincent Ladeuil
  • Date: 2009-01-27 10:35:38 UTC
  • mto: (3961.1.1 bzr.integration)
  • mto: This revision was merged to the branch mainline in revision 3963.
  • Revision ID: v.ladeuil+lp@free.fr-20090127103538-ogm13br9j6j98qzg
Fix bug #314525: don't try to put ids if there is no annotation.

* bzrlib/tests/blackbox/test_annotate.py:
(TestSimpleAnnotate.test_annotate_empty_file_show_ids): Reproduce
bug #314525.

* bzrlib/annotate.py:
(_show_id_annotations): Shortcut if the file is
empty (i.e. without annotations there is no place to put the
ids).

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
 
152
152
 
153
153
def _show_id_annotations(annotations, to_file, full):
154
 
    last_rev_id = None
155
 
    max_origin_len = max(len(origin) for origin, text in annotations)
156
 
    for origin, text in annotations:
157
 
        if full or last_rev_id != origin:
158
 
            this = origin
159
 
        else:
160
 
            this = ''
161
 
        to_file.write('%*s | %s' % (max_origin_len, this, text))
162
 
        last_rev_id = origin
 
154
    if annotations:
 
155
        last_rev_id = None
 
156
        max_origin_len = max(len(origin) for origin, text in annotations)
 
157
        for origin, text in annotations:
 
158
            if full or last_rev_id != origin:
 
159
                this = origin
 
160
            else:
 
161
                this = ''
 
162
            to_file.write('%*s | %s' % (max_origin_len, this, text))
 
163
            last_rev_id = origin
163
164
    return
164
165
 
165
166