Add line numbers to reviews in text emails.
Review Request #6864 — Created Jan. 31, 2015 and submitted
When a review has comments on the source code, text email notifications only show the files that have been changed, while HTML email notifications show the diff view. This change adds the line numbers of the patched files that have been commented on in a review to the email text body.
Now, the line numbers are shown as follows:
<file name> (Lines 18 - 25)
A new template tag has been implemented to render the line numbers of the code that have been commented on. It will render singular "Line" or plural "Lines" or none depending on the changes.
In reviewboard/reviews/views.py, we have added and exposed the
chunks
attribute to each comment entry withincomment_entries
. Also, the text email template will now make use of this new exposed attribute to render the individual commented files with line number information in each review.While testing this, we found a new bug:
https://code.google.com/p/reviewboard/issues/detail?id=3748
No unit tests have been written.
Manual testing has been conducted:
When no lines are selected in a review, nothing is affected.
When a range of lines over multiple chunks are selected, the line numbers display properly.
Chunks which have been deleted will not have their original line numbers shown, only line numbers in the patched file will be shown.
Description | From | Last Updated |
---|---|---|
Col: 1 W391 blank line at end of file |
reviewbot | |
Can you combine these? """Renders ... |
david | |
Remove this blank line. |
david | |
Can we wrap the format strings in gettext? We already import it, so you can just do _('(Line %d)') |
david | |
We probably need to define an empty 'chunks' list here, in case there was an exception in get_line_counts() or get_file_chunks_in_range() |
david | |
Blank line between a statement and a new block |
brennie | |
Has the error template changed to require the chunks parameter? |
brennie |
- Change Summary:
-
Removed the blank lines.
- Commit:
-
289bee879b18e581a68d7a63c5b883f8c7741c433cd06e630df317f57bdaa93e73fb340cb9e3c60a
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/reviews/templatetags/reviewtags.py Ignored Files: reviewboard/templates/notifications/review_email.txt Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/reviews/templatetags/reviewtags.py Ignored Files: reviewboard/templates/notifications/review_email.txt
- Description:
-
When a review has comments on the source code, text email notifications only show the files that have been changed, while HTML email notifications show the diff view. This change adds the line numbers of the patched files that have been commented on in a review to the email text body.
Now, the line numbers are shown as follows:
<file name> (Lines 18 - 25)
A new template tag has been implemented to render the line numbers of the code that have been commented on. It will render singular "Line" or plural "Lines" or none depending on the changes.
In reviewboard/reviews/views.py, we have added and exposed the
chunks
attribute to each comment entry withincomment_entries
. Also, the text email template will now make use of this new exposed attribute to render the individual commented files with line number information in each review.~ While testing this, we found a new bug where a single review request with multiple commit history will cause its line numbers to render extra lines if that line is part of a chunk from an older commit.
~ While testing this, we found a new bug:
+ https://code.google.com/p/reviewboard/issues/detail?id=3748 - Commit:
-
3cd06e630df317f57bdaa93e73fb340cb9e3c60add43bec1fba7260cab051f44d0cfb73ca45a3fa1
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/reviews/templatetags/reviewtags.py Ignored Files: reviewboard/templates/notifications/review_email.txt Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/reviews/templatetags/reviewtags.py Ignored Files: reviewboard/templates/notifications/review_email.txt
- Groups:
- Change Summary:
-
Added a line break as reviewed, and removed the chunks parameter since the error template has not been modified to display any information regarding it.
- Commit:
-
dd43bec1fba7260cab051f44d0cfb73ca45a3fa1f3babef4f1a1fddeb9d600fb5fb24850732a75f0
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/reviews/templatetags/reviewtags.py Ignored Files: reviewboard/templates/notifications/review_email.txt Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/reviews/templatetags/reviewtags.py Ignored Files: reviewboard/templates/notifications/review_email.txt