Rev 3961: Fix bug #314525: don't try to put ids if there is no annotation. in file:///net/bigmamac/Volumes/home/vila/src/bzr/bugs/314525-annotate-show-ids/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Tue Jan 27 10:35:45 GMT 2009
At file:///net/bigmamac/Volumes/home/vila/src/bzr/bugs/314525-annotate-show-ids/
------------------------------------------------------------
revno: 3961
revision-id: v.ladeuil+lp at free.fr-20090127103538-ogm13br9j6j98qzg
parent: pqm at pqm.ubuntu.com-20090126181248-yl5ctbxc3y6nu9m4
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 314525-annotate-show-ids
timestamp: Tue 2009-01-27 11:35:38 +0100
message:
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).
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS 2009-01-26 18:12:48 +0000
+++ b/NEWS 2009-01-27 10:35:38 +0000
@@ -14,6 +14,10 @@
BUG FIXES:
+ * ``bzr annotate --show-ids`` doesn't give a backtrace on empty files
+ anymore.
+ (Anne Mohsen, Vincent Ladeuil, #314525)
+
* There was a bug in how we handled resolving when a file is deleted
in one branch, and modified in the other. If there was a criss-cross
merge, we would cause the deletion to conflict a second time.
=== modified file 'bzrlib/annotate.py'
--- a/bzrlib/annotate.py 2008-09-02 01:26:52 +0000
+++ b/bzrlib/annotate.py 2009-01-27 10:35:38 +0000
@@ -151,15 +151,16 @@
def _show_id_annotations(annotations, to_file, full):
- last_rev_id = None
- max_origin_len = max(len(origin) for origin, text in annotations)
- for origin, text in annotations:
- if full or last_rev_id != origin:
- this = origin
- else:
- this = ''
- to_file.write('%*s | %s' % (max_origin_len, this, text))
- last_rev_id = origin
+ if annotations:
+ last_rev_id = None
+ max_origin_len = max(len(origin) for origin, text in annotations)
+ for origin, text in annotations:
+ if full or last_rev_id != origin:
+ this = origin
+ else:
+ this = ''
+ to_file.write('%*s | %s' % (max_origin_len, this, text))
+ last_rev_id = origin
return
=== modified file 'bzrlib/tests/blackbox/test_annotate.py'
--- a/bzrlib/tests/blackbox/test_annotate.py 2008-09-24 06:52:03 +0000
+++ b/bzrlib/tests/blackbox/test_annotate.py 2009-01-27 10:35:38 +0000
@@ -231,6 +231,16 @@
out, err = self.run_bzr('annotate empty')
self.assertEqual('', out)
+ def test_annotate_empty_file_show_ids(self):
+ tree = self.make_branch_and_tree('tree')
+ self.build_tree_contents([('tree/empty', '')])
+ tree.add('empty')
+ tree.commit('add empty file')
+
+ os.chdir('tree')
+ out, err = self.run_bzr(['annotate', '--show-ids', 'empty'])
+ self.assertEqual('', out)
+
def test_annotate_nonexistant_file(self):
tree = self.make_branch_and_tree('tree')
self.build_tree(['tree/file'])
More information about the bazaar-commits
mailing list