• 
      

    Add an API resource to verify diff files.

    Review Request #4252 — Created June 20, 2013 and submitted

    Information

    Review Board
    master

    Reviewers

    Add an API resource to verify diff files.
    
    This change adds a resource to /api/verify-diff/ which accepts POST requests
    with arguments similar to DiffResource, but does not actually create a diff.
    This allows prospective clients (such as the web UI or rbtools) to validate
    whether a diff file will be usable before creating a review request for it.
    
    Ran unit tests.
    Description From Last Updated

    Should end with a period.

    chipx86 chipx86

    Missing docstrings for the API docs.

    chipx86 chipx86

    I think we should have a /validation/ resource, and add this as a child (/validation/diffs/). That'd allow us to add …

    chipx86 chipx86

    Do we need the default of None? IIRC, Djblets's validation doesn't properly look in request.FILES. We should fix that... Either …

    chipx86 chipx86

    This is weird. Can we do one try block that builds the query, and another that executes?

    chipx86 chipx86
    chipx86
    1. 
        
    2. reviewboard/webapi/errors.py (Diff revision 1)
       
       
      Show all issues
      Should end with a period.
    3. reviewboard/webapi/resources.py (Diff revision 1)
       
       
      Show all issues
      Missing docstrings for the API docs.
    4. reviewboard/webapi/resources.py (Diff revision 1)
       
       
       
      Show all issues
      I think we should have a /validation/ resource, and add this as a child (/validation/diffs/). That'd allow us to add more types of validators down the road, without polluting the root namespace.
    5. reviewboard/webapi/resources.py (Diff revision 1)
       
       
      Show all issues
      Do we need the default of None?
      
      IIRC, Djblets's validation doesn't properly look in request.FILES. We should fix that... Either way, if path can be None, we should probably check that early and return an INVALID_FORM_DATA error.
      1. Checking the existence of 'path' is handled by the fields decorator.
    6. reviewboard/webapi/resources.py (Diff revision 1)
       
       
       
      Show all issues
      This is weird. Can we do one try block that builds the query, and another that executes?
    7. reviewboard/webapi/resources.py (Diff revision 1)
       
       
       
       
      Wondering if create_from_upload could take a save=False to prevent actually saving the diff (and related objects), so we don't have to delete it after (and use up an ID).
    8. 
        
    david
    chipx86
    1. Ship It!
    2. 
        
    david
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to master (afefe51).