Add initial web API for commit histories.
Review Request #6816 — Created Jan. 20, 2015 and submitted — Latest diff uploaded
Add the
DiffCommitResource
andDraftDiffCommitResource
resources.
TheDiffCommitResource
is a resource for retrieving the information
about theDiffCommits
under a particularDiffSet
. The
DraftDiffCommitResource
inherits from theDiffCommitResource
and
modifies it to allow for the creation ofDiffCommits
and associated
FileDiffs
. TheDraftDiffCommitResource
handles the uploading of
FileDiffs
forDiffCommits
instead of theDiffSetResource
.The
DiffSetResource
POST 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
FileDiffResource
andDraftFileDiffResource
classes now filter
their results based on the commit query parameter. If no commit query
parameter is given, only thoseFileDiffs
unattached to a
DiffCommit
will 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 newDiffCommit
instances.Refactor behaviour for uploading
FileDiffs
from theDiffSetManager
to a new class, theDiffProcessorMixin
. This mix-in handles the
initial processing of.diff
files, 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
DiffSetManager
now has acreate_empty
method for creating
DiffSets
withoutFileDiffs
for usage withDiffCommits
.Add the
DiffCommitManager
model. It inherits from the
DiffProcessorMixin
.Add a WebAPI capability to show that the server supports review
requests with commit histories. This allows new versions ofrbt
that
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 testsFileDiff
filtering 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
FileDiff
list resource. - The
FileDiff
item 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