Add initial web API for commit histories.
Review Request #6816 — Created Jan. 21, 2015 and submitted — Latest diff uploaded
Add the
DiffCommitResourceandDraftDiffCommitResourceresources.
TheDiffCommitResourceis a resource for retrieving the information
about theDiffCommitsunder a particularDiffSet. The
DraftDiffCommitResourceinherits from theDiffCommitResourceand
modifies it to allow for the creation ofDiffCommitsand associated
FileDiffs. TheDraftDiffCommitResourcehandles the uploading of
FileDiffsforDiffCommitsinstead of theDiffSetResource.The
DiffSetResourcePOST method now takes an extra optional field,
create_empty, that determines if the DiffSet that is created is
created without uploading a.diff file. This is used in the creation
of review requests with commit histories.The
FileDiffResourceandDraftFileDiffResourceclasses now filter
their results based on the commit query parameter. If no commit query
parameter is given, only thoseFileDiffsunattached to a
DiffCommitwill be return. This filtering is only applied to the
list API, not the item API.Add a new form, the
UploadCommitForm, for handling the processing of
data for creating newDiffCommitinstances.Refactor behaviour for uploading
FileDiffsfrom theDiffSetManager
to a new class, theDiffProcessorMixin. This mix-in handles the
initial processing of.difffiles, their comparison (for header vs.
source files), generating file lists, and creating actualFileDiffs
from upload (it calls the child class's implementation of
create_from_data).The
DiffSetManagernow has acreate_emptymethod for creating
DiffSetswithoutFileDiffsfor usage withDiffCommits.Add the
DiffCommitManagermodel. It inherits from the
DiffProcessorMixin.Add a WebAPI capability to show that the server supports review
requests with commit histories. This allows new versions ofrbtthat
support commit histories to create review requests with history by
default if the tool supports it.Add new unit tests for the web API. The tests include:
-test_filediff, which testsFileDifffiltering of aDiffCommit
-test_draft_diff_commit, which does the base API tests for the
DraftDiffCommitResource
-test_diff_commit, which does the base API tests for the
DiffCommitResource
Unit tests pass.
Did the following manual testing:
- Created a review request via
rbt post. It was automatically
created with history. (There was one commit under the draft). - Able to read the commit list and single commit via the API.
- Able to filter the
FileDifflist resource. - The
FileDiffitem resource was not filtered. - Able to publish, discard, and delete the review request.
- Able to use all the public API endoint functionality of the
published RR anonymously