Enhance the diff file attachment resource a bit.

Review Request #13603 — Created March 4, 2024 and submitted

Information

Review Board
release-7.x

Reviewers

This change makes two enhancements to the diff file attachment resource.

First, a new source_file argument allows uploading a file for the source
version of the FileDiff. In most cases we can allow the server to fetch
it from the repository, but in the case where there's a parent diff, the
uploading client needs to provide both the source and modified versions.

Second, I did run into a case where I successfully uploaded two files
for the same FileDiff, which caused errors later on. A new API error has
been added for this case.

  • Ran unit tests.
  • Posted binary file changes that used a parent diff and successfully
    uploaded both the source and modified versions.
Summary ID
Enhance the diff file attachment resource a bit.
This change makes two enhancements to the diff file attachment resource. First, a new source_file argument allows uploading a file for the source version of the FileDiff. In most cases we can allow the server to fetch it from the repository, but in the case where there's a parent diff, the uploading client needs to provide both the source and modified versions. Second, I did run into a case where I successfully uploaded two files for the same FileDiff, which caused errors later on. A new API error has been added for this case. Testing Done: - Ran unit tests. - Posted binary file changes that used a parent diff and successfully uploaded both the source and modified versions.
c758222eb441e6b6c36473de0e0e547aaaa72f97
Description From Last Updated

Can we make this keyword-only? (Ideally both, but at least this one.)

chipx86chipx86

This is missing a return value.

chipx86chipx86

Should state that these are now keyword-only.

chipx86chipx86

We should add version info here and in the method's docstring.

chipx86chipx86

This is missing version info.

chipx86chipx86

This is set above as modified.

chipx86chipx86
chipx86
  1. 
      
  2. reviewboard/attachments/forms.py (Diff revision 1)
     
     
    Show all issues

    Can we make this keyword-only? (Ideally both, but at least this one.)

  3. reviewboard/attachments/forms.py (Diff revision 1)
     
     
    Show all issues

    This is missing a return value.

  4. reviewboard/attachments/forms.py (Diff revision 1)
     
     
     
     
     
    Show all issues

    We should add version info here and in the method's docstring.

  5. reviewboard/webapi/resources/diff_file_attachment.py (Diff revision 1)
     
     
     
     
     
     
     
     
    Show all issues

    This is missing version info.

  6. Show all issues

    This is set above as modified.

  7. 
      
david
chipx86
  1. 
      
  2. reviewboard/attachments/forms.py (Diff revisions 1 - 2)
     
     
     
     
    Show all issues

    Should state that these are now keyword-only.

  3. 
      
maubin
  1. Ship It!
  2. 
      
david
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-7.x (33fb5e9)
Loading...