Provide a sane error if encountering multiple conflicting repositories.

Review Request #7459 — Created June 26, 2015 and submitted

Information

Review Board
release-2.0.x
7f1f601...

Reviewers

If two repositories conflict (one has a Mirror Path matching the Path of
another repository), then validating a diff or creating a review request
in the API will result in an HTTP 500 error, due to a
MultipleObjectsReturned exception.

We now check for this and provide a more reasonable error message
instead, with a suggestion for how to resolve the issue.

Unit tests pass.

Description From Last Updated

I thought we were moving away from doing IO in tests just to read data?

brenniebrennie
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/tests/test_validate_diff.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/tests/test_validate_diff.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
  2. 
      
brennie
  1. 
      
  2. reviewboard/webapi/tests/test_validate_diff.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    I thought we were moving away from doing IO in tests just to read data?

    1. Generally, yes, but not in all cases. In this one, it's worth going that direction, though given that the other tests are all using the same data, I was tempted just to have them all transition over in the same change.

      Some other changes, like ones that need a binary file for testing (trophy.png), will likely continue to do disk IO. We also do IO for fixtures.

  3. 
      
chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/tests/test_validate_diff.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/webapi/resources/validate_diff.py
        reviewboard/webapi/tests/test_validate_diff.py
        reviewboard/webapi/resources/review_request.py
        reviewboard/webapi/tests/test_review_request.py
    
    
  2. 
      
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (8fd58f2)