Rev 453: Merge Francesco's fix for bug #812583 in http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

John Arbash Meinel john at arbash-meinel.com
Tue Aug 9 20:03:37 UTC 2011


At http://bazaar.launchpad.net/~loggerhead-team/loggerhead/trunk-rich

------------------------------------------------------------
revno: 453 [merge]
revision-id: john at arbash-meinel.com-20110809200327-r5foyvf732j0acop
parent: andrew.bennetts at canonical.com-20110628173100-owrifrnckvoi60af
parent: f.deldegan at pr0gg3d.net-20110809134511-0m4u5c9jspzrd53v
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk-rich
timestamp: Tue 2011-08-09 22:03:27 +0200
message:
  Merge Francesco's fix for bug #812583
modified:
  loggerhead/controllers/annotate_ui.py annotate_ui.py-20101130101535-elf3r4k8smkr5h0g-1
  loggerhead/tests/test_controllers.py test_controllers.py-20090210051739-5d14nlvjvn2ep4x5-1
-------------- next part --------------
=== modified file 'loggerhead/controllers/annotate_ui.py'
--- a/loggerhead/controllers/annotate_ui.py	2011-04-22 17:22:26 +0000
+++ b/loggerhead/controllers/annotate_ui.py	2011-08-09 07:29:00 +0000
@@ -46,7 +46,11 @@
                     change = self._history.get_changes([line_revid])[0]
                     change_cache[line_revid] = change
 
-                message = change.comment.splitlines()[0]
+                try:
+                    message = change.comment.splitlines()[0]
+                except IndexError:
+                    # Comment not present for this revision
+                    message = ""
 
                 if last_lineno:
                     # The revspan is of lines between the last revision and this one.

=== modified file 'loggerhead/tests/test_controllers.py'
--- a/loggerhead/tests/test_controllers.py	2011-06-28 16:06:12 +0000
+++ b/loggerhead/tests/test_controllers.py	2011-08-09 13:45:11 +0000
@@ -117,16 +117,16 @@
         tree = self.make_branch_and_tree('.')
         self.build_tree_contents([('filename', '')])
         tree.add(['filename'], [file_id])
-        for rev_id, text in rev_ids_texts:
+        for rev_id, text, message in rev_ids_texts:
             self.build_tree_contents([('filename', text)])
-            tree.commit(rev_id=rev_id, message='.')
+            tree.commit(rev_id=rev_id, message=message)
         tree.branch.lock_read()
         self.addCleanup(tree.branch.unlock)
         branch_app = BranchWSGIApp(tree.branch, friendly_name='test_name')
         return AnnotateUI(branch_app, branch_app.get_history)
 
     def test_annotate_file(self):
-        history = [('rev1', 'old\nold\n'), ('rev2', 'new\nold\n')]
+        history = [('rev1', 'old\nold\n', '.'), ('rev2', 'new\nold\n', '.')]
         ann_ui = self.make_annotate_ui_for_file_history('file_id', history)
         # A lot of this state is set up by __call__, but we'll do it directly
         # here.
@@ -137,8 +137,15 @@
         self.assertEqual(2, len(annotated))
         self.assertEqual('2', annotated[1].change.revno)
         self.assertEqual('1', annotated[2].change.revno)
-
-
+    
+    def test_annotate_empty_comment(self):
+        # Testing empty comment handling without breaking
+        history = [('rev1', 'old\nold\n', '.'), ('rev2', 'new\nold\n', '')]
+        ann_ui = self.make_annotate_ui_for_file_history('file_id', history)
+        ann_ui.args = ['rev2']
+        annotate_info = ann_ui.get_values('filename',
+            kwargs={'file_id': 'file_id'}, headers={})
+    
 class TestFileDiffUI(BasicTests):
 
     def make_branch_app_for_filediff_ui(self):



More information about the bazaar-commits mailing list