Add typing structures for the diff viewer context.

Review Request #13666 — Created March 25, 2024 and submitted — Latest diff uploaded

Information

Review Board
release-7.x

Reviewers

The context that's assembled and used to render the diff viewer page
(both the HTML-based UI and the diff context API endpoint) has grown
organically since the very earliest days of Review Board, and is a
pretty big hairy mess. In order to bring at least a little bit of sanity
to it, this change adds typing structures so that type checkers can
verify that we're always assigning things correctly.

The only actual change to the content of the context is that we can no
longer end up with non-bool types for the is_draft_diff and
is_draft_interdiff fields.

Ran unit tests.

Diff Revision 1

This is not the most recent revision of the diff. The latest diff is revision 2. See what's changed.

orig
1
2

Commits

First Last Summary ID Author
Add typing structures for the diff viewer context.
The context that's assembled and used to render the diff viewer page (both the HTML-based UI and the diff context API endpoint) has grown organically since the very earliest days of Review Board, and is a pretty big hairy mess. In order to bring at least a little bit of sanity to it, this change adds typing structures so that type checkers can verify that we're always assigning things correctly. The only actual change to the content of the context is that we can no longer end up with non-`bool` types for the `is_draft_diff` and `is_draft_interdiff` fields. Testing Done: - Ran unit tests.
03f29610d7496efc3344e9c8a65d8f07acc4285c David Trowbridge
reviewboard/diffviewer/commit_utils.py
reviewboard/diffviewer/diffutils.py
reviewboard/diffviewer/views.py
reviewboard/diffviewer/models/diffcommit.py
reviewboard/reviews/context.py
reviewboard/reviews/models/base_review_request_details.py
reviewboard/reviews/models/review_request.py
reviewboard/reviews/views/diffviewer.py
reviewboard/webapi/tests/test_diff_context.py
Loading...