Prevent conflicts with commit IDs when dealing with drafts.

Review Request #6264 — Created Aug. 25, 2014 and submitted

Information

Review Board
release-2.0.x
0dee420...

Reviewers

There were a series of errors that could result from commit ID conflicts
between review requests and drafts. There were a couple scenarios in
which a conflict could arrise:

* Updating a draft with a commit ID and then posting a new review
request with the same commit ID.

* Updating two drafts with the same commit ID and trying to publish
both.

A lot of these problems were due to us relying on database-level
validation for conflict reporting, and not factoring in drafts at all.

We now check for both review requests and drafts with the provided
commit ID before allowing any operations that would result in commit ID
assignment to either a review request or its draft. For the case of
creating a new review request, we do this regardless of whether the
create_from_commit_id flag is set.

All unit tests pass.

Tested the following scenarios:

1) Posted a review request with a commit ID. Tried posting another with the same ID. (Neither was published, but commit IDs stored in the ReviewRequest). The second failed with the expected error.

2) Posted a review request with a commit ID. Updated it with a new commit ID. Tried posting a new review request with the same new commit ID. It failed with the expected error.

3) Posted a review request with a new commit ID. Posted a second review request with a different commit ID. Tried updating both with a new commit ID. It failed with the expected error.

4) Posted a review request with a commit ID. Successfully posted another review request with a different commit ID.

5) Posted a review request with a commit ID. Updated with a different commit ID.

Description From Last Updated

Col: 21 E126 continuation line over-indented for hanging indent

reviewbotreviewbot

local variable 'rsp' is assigned to but never used

reviewbotreviewbot

local variable 'rsp' is assigned to but never used

reviewbotreviewbot

local variable 'rsp' is assigned to but never used

reviewbotreviewbot

local variable 'rsp' is assigned to but never used

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/tests/test_review_request_draft.py
        reviewboard/reviews/tests.py
        reviewboard/webapi/tests/test_review_request.py
        reviewboard/reviews/managers.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/review_request_draft.py
        reviewboard/webapi/tests/test_review_request_draft.py
        reviewboard/reviews/tests.py
        reviewboard/webapi/tests/test_review_request.py
        reviewboard/reviews/managers.py
    
    
  2. Show all issues
    Col: 21
     E126 continuation line over-indented for hanging indent
    
  3. Show all issues
     local variable 'rsp' is assigned to but never used
    
  4. Show all issues
     local variable 'rsp' is assigned to but never used
    
  5. Show all issues
     local variable 'rsp' is assigned to but never used
    
  6. Show all issues
     local variable 'rsp' is assigned to but never used
    
  7. 
      
david
  1. Ship It!

  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-2.0.x (249a691)
Loading...