Initial backend support for review requests with commit history.

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

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/).

Description From Last Updated

Col: 1 W293 blank line contains whitespace

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 1 W293 blank line contains whitespace

reviewbotreviewbot

Col: 1 W293 blank line contains whitespace

reviewbotreviewbot

Col: 80 E501 line too long (82 > 79 characters)

reviewbotreviewbot

Col: 1 E302 expected 2 blank lines, found 1

reviewbotreviewbot

Col: 25 E131 continuation line unaligned for hanging indent

reviewbotreviewbot

Col: 29 E131 continuation line unaligned for hanging indent

reviewbotreviewbot

Col: 80 E501 line too long (80 > 79 characters)

reviewbotreviewbot

Col: 1 E303 too many blank lines (3)

reviewbotreviewbot

Col: 1 W293 blank line contains whitespace

reviewbotreviewbot

'datetime' imported but unused

reviewbotreviewbot

'urlencode' imported but unused

reviewbotreviewbot

'get_resource_for_object' imported but unused

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. reviewboard/diffviewer/forms.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     W293 blank line contains whitespace
    
  3. reviewboard/diffviewer/forms.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  4. reviewboard/diffviewer/managers.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     W293 blank line contains whitespace
    
  5. reviewboard/diffviewer/managers.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     W293 blank line contains whitespace
    
  6. reviewboard/diffviewer/managers.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (82 > 79 characters)
    
  7. reviewboard/diffviewer/managers.py (Diff revision 1)
     
     
    Show all issues
    Col: 1
     E302 expected 2 blank lines, found 1
    
  8. Show all issues
    Col: 25
     E131 continuation line unaligned for hanging indent
    
  9. Show all issues
    Col: 29
     E131 continuation line unaligned for hanging indent
    
  10. Show all issues
    Col: 80
     E501 line too long (80 > 79 characters)
    
  11. Show all issues
    Col: 1
     E303 too many blank lines (3)
    
  12. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. reviewboard/diffviewer/forms.py (Diff revision 3)
     
     
    Show all issues
    Col: 1
     W293 blank line contains whitespace
    
  3. Show all issues
     'datetime' imported but unused
    
  4. Show all issues
     'urlencode' imported but unused
    
  5. Show all issues
     'get_resource_for_object' imported but unused
    
  6. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/diffviewer/admin.py
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/diffviewer/evolutions/__init__.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/evolutions/add_commit_history_fields.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/diffviewer/admin.py
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/diffviewer/evolutions/__init__.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/evolutions/add_commit_history_fields.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
reviewbot
  1. Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
    
    Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/draft_diff.py
        reviewboard/webapi/resources/__init__.py
        reviewboard/webapi/resources/draft_diff_commit.py
        reviewboard/webapi/server_info.py
        reviewboard/diffviewer/models.py
        reviewboard/webapi/resources/filediff.py
        reviewboard/webapi/resources/diff.py
        reviewboard/webapi/resources/diff_commit.py
        reviewboard/diffviewer/forms.py
        reviewboard/diffviewer/managers.py
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/resources/draft_filediff.py
    
    
  2. 
      
brennie
Review request changed
Status:
Discarded
Change Summary:

Splitting this up more.