Rev 3962: Fix bug #314525: don't try to put ids if there is no annotation in http://bazaar.launchpad.net/%7Evila/bzr/bzr.integration

Vincent Ladeuil v.ladeuil+lp at free.fr
Tue Jan 27 17:36:33 GMT 2009


At http://bazaar.launchpad.net/%7Evila/bzr/bzr.integration

------------------------------------------------------------
revno: 3962
revision-id: v.ladeuil+lp at free.fr-20090127173602-c4r1ua3w7rz1ypgz
parent: pqm at pqm.ubuntu.com-20090127171757-9pgye6upofwicmsc
parent: v.ladeuil+lp at free.fr-20090127173234-ksrb3hxbpdo8traf
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: bzr.integration
timestamp: Tue 2009-01-27 18:36:02 +0100
message:
  Fix bug #314525: don't try to put ids if there is no annotation
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
  bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
    ------------------------------------------------------------
    revno: 3960.1.2
    revision-id: v.ladeuil+lp at free.fr-20090127173234-ksrb3hxbpdo8traf
    parent: v.ladeuil+lp at free.fr-20090127103538-ogm13br9j6j98qzg
    committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
    branch nick: 314525-annotate-show-ids
    timestamp: Tue 2009-01-27 18:32:34 +0100
    message:
      Don't outsmart original author !
      
      * bzrlib/annotate.py:
      (_show_id_annotations): Revert to Anne's way since jam agrees with
      her :)
    modified:
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
    ------------------------------------------------------------
    revno: 3960.1.1
    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).
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/annotate.py             annotate.py-20050922133147-7c60541d2614f022
      bzrlib/tests/blackbox/test_annotate.py testannotate.py-20051013044000-457f44801bfa9d39
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2009-01-27 16:16:13 +0000
+++ b/NEWS	2009-01-27 17:36:02 +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 17:32:34 +0000
@@ -151,6 +151,8 @@
 
 
 def _show_id_annotations(annotations, to_file, full):
+    if not annotations:
+        return
     last_rev_id = None
     max_origin_len = max(len(origin) for origin, text in annotations)
     for origin, text in annotations:
@@ -159,7 +161,7 @@
         else:
             this = ''
         to_file.write('%*s | %s' % (max_origin_len, this, text))
-        last_rev_id = origin
+            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