Hello UCOSP students!
Previously, ReviewBoard only allows per-review attachments. We need a mechanism for per-diff file attachments for binary files, since the diff for binary files cannot be textually displayed. The project aims to enable this feature. The project is split into the following parts:
- Modify the current database structure to allowing storage of per-diff attachments
- Enable display of per-diff attachments on the diff-viewer page
- Modify the server-side JSON API to enable uploading of per-diff attachments
- Modify the client-side post-review tool to enable automatic uploading of per-diff attachments
Due to time constraints, only part 1 and 2 of the project have been completed, and the code is in for review (have received many reviews, now only minor code formatting to be fixed). Please see the following URL for the review:
Some explanation about the code changes for part 1 and 2:
In attachments/models.py, two database fields are added:
diff_source_file : the original(source) file name of the particular diff
diff_source_revision : the revision number of the source file
In the attachments/tests.py, a new test case has been added to test the model change.
NOTE: The attachments/evolutions/dd_binary_attachment.py is added to added to apply the database model change. It is based on the Django Evolution and it must be applied to the database. Please see the documentation for Django Evolution on how to apply the change.
In the diffviewer/views.py, code has been added to query the database for attachments that have matching source file name and revision number for each binary file diff in the review. The found attachments are added to the “context” and sent to the diff viewer page.
On the diff viewer page, templates/diffviewer/diff_file_fragment.html, code snippet has been added to display the per-diff attachments in the context, if any.
For the details of code changes, please see the review at the URL given above. If you have any questions, please feel free to contact the UCOSP mailing lists. Thanks and have a good term!