From 0e770f0df67c02c3949173f062359fbea2384505 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 28 Mar 2019 07:57:41 -0700 Subject: [PATCH] Fix change view display of inline comments in python3 File comments were causing an exception when displayed on the change view because python3 does not allow comparing None to int, and file comments have a line number of None. To correct this, use 0 as the line number for file comments whin sorting and displaying them in the change view; there is no line 0 so this minor aliasing shouldn't cause any collisions. Also, add a newline to the end of file comments, just as regular inline comments (otherwise if a file comment was followed by a line comment, they would appear on the same line). Change-Id: Iedf88cdfd83adbc405e26cb013c9f57481d50c90 --- gertty/view/change.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gertty/view/change.py b/gertty/view/change.py index e7bf373..a036be3 100644 --- a/gertty/view/change.py +++ b/gertty/view/change.py @@ -455,7 +455,7 @@ class ChangeMessageBox(mywid.HyperText): for comment in comments: path = comment.file.path inline_comments.setdefault(path, []) - inline_comments[path].append((comment.line, comment.message)) + inline_comments[path].append((comment.line or 0, comment.message)) for v in inline_comments.values(): v.sort() @@ -464,8 +464,8 @@ class ChangeMessageBox(mywid.HyperText): for key, value in inline_comments.items(): comment_text.append(('filename-inline-comment', u'%s' % key)) for line, comment in value: - if line is None: - comment_text.append(u'\n %s' % comment) + if not line: + comment_text.append(u'\n %s\n' % comment) else: comment_text.append(u'\n %s: %s\n' % (line, comment))