Initial backend support for review requests with commit history.

Review Request #6779 — Created Jan. 15, 2015 and discarded — Latest diff uploaded

Information

Review Board
master

Reviewers

Add the DiffCommitResource and DraftDiffCommitResource resources.
The DiffCommitResource is a resource for retrieving the information
about the Commits under a particular DiffSet. The
DraftDiffCommitResource inherits from the DiffCommitResource and
modifies it to allow for the creation of Commits and associated
FileDiffs. The DraftDiffCommitResource handles the uploading of
FileDiffs for Commits instead of the DiffSetResource.

Register the Commit model for both DiffCommitResource and
DraftDiffCommitResource in the API. They are item child resources of
the DiffSetResource and DraftDiffSetResource resources,
respectively.

The DiffSetResource.create 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 and DraftFileDiffResource classes now filter
their results based on the commit query parameter. If no commit
query parameter is given, only those FileDiffs unattached to a
Commit 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 new Commit instances. It is very similar to
diffviewer.forms.UploadDiffForm and may need to be refactored.

Refactor behaviour for uploading FileDiffs from the DiffSetManager
to a new class, the DiffProcessorMixin. This mix-in handles the
initial processing of .diff files, their comparison (for header vs
source files), generating file lists, and creating actual FileDiffs
from upload (it calls the child class's implementation of
create_from_data).

The DiffSetManager now has a create_empty method for creating
DiffSets without FileDiffs for usage with Commits.

Add the CommitManager model. It inherits from the
DiffProcessorMixin.

Update the validate_diff endpoint to use named parameters for
DiffSetManager.create_from_upload because of the refactoring.

Add a WebAPI capability to show that the server supports review
requests with commit histories.

TODO:
- Unit tests forthcoming.
- Manual testing information forthcoming.

Ran unit tests.
Able to create a review request with a single commit of history via
RBTools (see: https://reviews.reviewboard.org/r/6787/).

    Loading...