Fix diff attachment and default reviewers for post-commit review.
Review Request #8539 — Created Nov. 15, 2016 and submitted
We had a very, very old bug with post-commit review where the diffs from the posted commit would be attached to the Review Request's diffset history, rather than the draft. This made the diff accessible to superusers who had access to the review request, which wasn't a big deal, but more importantly it meant the diff wasn't accessible via the draft API and default reviewers would not apply. This change fixes this by redoing some of that logic. Formerly, the code for updating was assuming it would be called on either the draft or review request, but in practice now it's only ever called on the draft, so that has moved into ReviewRequestDraft and has been updated to associate there instead of the review request history. That also required some new code that figured out a suitable revision for the diffset. Since that's already been done in two other places, the logic has been centralized (and optimized to reduce the data returned from an SQL query). Some unit tests were added and others moved around to test against the draft instead of review request.
Unit tests pass.
Tested post-commit review with default reviewers. It worked.
- Change Summary:
-
Fixed missing/unused imports.
- Commit:
-
9ce7ad9ab5fd79bad0966dec169af1e9435094b6992e08a2471ca7581e59618565ea3371051b0265
- Diff:
-
Revision 2 (+387 -244)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/tests/test_review_request_manager.py reviewboard/scmtools/models.py reviewboard/reviews/tests/test_review_request_draft.py reviewboard/diffviewer/models.py reviewboard/reviews/tests/test_review_request.py reviewboard/reviews/models/review_request_draft.py reviewboard/diffviewer/tests.py reviewboard/reviews/forms.py reviewboard/reviews/managers.py reviewboard/reviews/models/base_review_request_details.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/tests/test_review_request_manager.py reviewboard/scmtools/models.py reviewboard/reviews/tests/test_review_request_draft.py reviewboard/diffviewer/models.py reviewboard/reviews/tests/test_review_request.py reviewboard/reviews/models/review_request_draft.py reviewboard/diffviewer/tests.py reviewboard/reviews/forms.py reviewboard/reviews/managers.py reviewboard/reviews/models/base_review_request_details.py
- Change Summary:
-
Condensed a couple of statements.
- Commit:
-
992e08a2471ca7581e59618565ea3371051b0265b4dccffa8d331d96dbd873c95599e9a458daeed8
- Diff:
-
Revision 3 (+385 -244)
-
Tool: Pyflakes Processed Files: reviewboard/reviews/tests/test_review_request_manager.py reviewboard/scmtools/models.py reviewboard/reviews/tests/test_review_request_draft.py reviewboard/diffviewer/models.py reviewboard/reviews/tests/test_review_request.py reviewboard/reviews/models/review_request_draft.py reviewboard/diffviewer/tests.py reviewboard/reviews/forms.py reviewboard/reviews/managers.py reviewboard/reviews/models/base_review_request_details.py Tool: PEP8 Style Checker Processed Files: reviewboard/reviews/tests/test_review_request_manager.py reviewboard/scmtools/models.py reviewboard/reviews/tests/test_review_request_draft.py reviewboard/diffviewer/models.py reviewboard/reviews/tests/test_review_request.py reviewboard/reviews/models/review_request_draft.py reviewboard/diffviewer/tests.py reviewboard/reviews/forms.py reviewboard/reviews/managers.py reviewboard/reviews/models/base_review_request_details.py