Add a better display for patch errors.
Review Request #8563 — Created Dec. 6, 2016 and submitted
When a file fails to patch, we would show a pretty terrible error message. It
would give the location of the temp directory with the original and rejects
files, and then theoretically show the error output from thepatch
command
(although in the case where hunks couldn't be applied, that error output
wouldn't be shown because it's displayed to stdout instead of stderr).This replaces that with a new display that actually shows the patch output
(with temporary directory names filtered out), and instead of forcing the
administrator to dig through that directory, allows the user to either show the
rejects inline on the page or download a .zip bundle containing the original
file, the new file, the diff, and the rejects.Based on work by Tien Vu.
- Uploaded a hand-modified patch that would fail to apply cleanly. Saw the new
output. Viewed rejects inline and checked the contents of the downloaded
error bundle. - Ran unit tests.
Description | From | Last Updated |
---|---|---|
'format_html' imported but unused |
reviewbot | |
'local_site_reverse' imported but unused |
reviewbot | |
local variable 'response' is assigned to but never used |
reviewbot | |
Col: 17 E127 continuation line over-indented for visual indent |
reviewbot | |
This will also catch, for example, KeyboardInterrupt, RumtimeError and other non-Exceptions that are meant to terminate the program. We should … |
brennie | |
Put the ) on the following line for symmetry? |
brennie | |
Can you put args starting on the next line indented by 4? |
brennie | |
Same here. |
brennie | |
And here. |
brennie | |
Can we add Args, Returns, and Raises while here? |
chipx86 | |
I missed this one. except Exception here too. |
brennie | |
In the try/except above, we set new_file = None in the except. For rejects, we're setting it before-hand. Let's move … |
chipx86 | |
Can we move this into the __init__ call? |
chipx86 | |
Swap these. |
chipx86 | |
Swap these. |
chipx86 | |
Is this change related to your work? Raising Http404 actually presents a 404 page, whereas returning HttpResponseNotFound returns an empty … |
chipx86 | |
Can we use local_site_reverse here? |
chipx86 | |
Let's give these names. |
chipx86 | |
Alphabetical. |
chipx86 | |
This can be removed. |
chipx86 |
- Change Summary:
-
Credit where credit is due.
- Description:
-
When a file fails to patch, we would show a pretty terrible error message. It
would give the location of the temp directory with the original and rejects files, and then theoretically show the error output from the patch
command(although in the case where hunks couldn't be applied, that error output wouldn't be shown because it's displayed to stdout instead of stderr). This replaces that with a new display that actually shows the patch output
(with temporary directory names filtered out), and instead of forcing the administrator to dig through that directory, allows the user to either show the rejects inline on the page or download a .zip bundle containing the original file, the new file, the diff, and the rejects. + + Based on work by Tien Vu.
- Commit:
-
19d22d1ae987ad35120fd29ba7bd69c8e849f9ee79366c1e9be6f60d67ad978b6bafa40359472c83
- Diff:
-
Revision 2 (+457 -152)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/webapi/resources/base_patched_file.py reviewboard/reviews/urls.py reviewboard/diffviewer/errors.py reviewboard/diffviewer/views.py reviewboard/diffviewer/diffutils.py Ignored Files: reviewboard/templates/diffviewer/diff_fragment_patch_error.html reviewboard/templates/diffviewer/diff_fragment_error.html reviewboard/templates/diffviewer/diff_fragment_error_base.html reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/webapi/resources/base_patched_file.py reviewboard/reviews/urls.py reviewboard/diffviewer/errors.py reviewboard/diffviewer/views.py reviewboard/diffviewer/diffutils.py Ignored Files: reviewboard/templates/diffviewer/diff_fragment_patch_error.html reviewboard/templates/diffviewer/diff_fragment_error.html reviewboard/templates/diffviewer/diff_fragment_error_base.html reviewboard/static/rb/css/pages/diffviewer.less
- Commit:
-
79366c1e9be6f60d67ad978b6bafa40359472c83c659ea072c4b500db373d3c0e29b1d987ee11c34
- Diff:
-
Revision 3 (+463 -157)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/webapi/resources/base_patched_file.py reviewboard/reviews/urls.py reviewboard/diffviewer/errors.py reviewboard/diffviewer/views.py reviewboard/diffviewer/diffutils.py Ignored Files: reviewboard/templates/diffviewer/diff_fragment_patch_error.html reviewboard/templates/diffviewer/diff_fragment_error.html reviewboard/templates/diffviewer/diff_fragment_error_base.html reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/webapi/resources/base_patched_file.py reviewboard/reviews/urls.py reviewboard/diffviewer/errors.py reviewboard/diffviewer/views.py reviewboard/diffviewer/diffutils.py Ignored Files: reviewboard/templates/diffviewer/diff_fragment_patch_error.html reviewboard/templates/diffviewer/diff_fragment_error.html reviewboard/templates/diffviewer/diff_fragment_error_base.html reviewboard/static/rb/css/pages/diffviewer.less
- Commit:
-
c659ea072c4b500db373d3c0e29b1d987ee11c3479b61777eff73691fcbdb6693370f851a7b75893
- Diff:
-
Revision 4 (+491 -158)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/views.py reviewboard/webapi/resources/base_patched_file.py reviewboard/reviews/urls.py reviewboard/diffviewer/errors.py reviewboard/diffviewer/views.py reviewboard/diffviewer/diffutils.py Ignored Files: reviewboard/templates/diffviewer/diff_fragment_patch_error.html reviewboard/templates/diffviewer/diff_fragment_error.html reviewboard/templates/diffviewer/diff_fragment_error_base.html reviewboard/static/rb/css/pages/diffviewer.less Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/views.py reviewboard/webapi/resources/base_patched_file.py reviewboard/reviews/urls.py reviewboard/diffviewer/errors.py reviewboard/diffviewer/views.py reviewboard/diffviewer/diffutils.py Ignored Files: reviewboard/templates/diffviewer/diff_fragment_patch_error.html reviewboard/templates/diffviewer/diff_fragment_error.html reviewboard/templates/diffviewer/diff_fragment_error_base.html reviewboard/static/rb/css/pages/diffviewer.less