Add get_file_content APIs for Perforce and improve revision range diffs.

Review Request #13593 — Created March 1, 2024 and submitted

Information

RBTools
release-5.x

Reviewers

This change makes two improvements to the Perforce client backend in
RBTools. First, this implements the new get_file_content and
get_file_size APIs for use with uploading binary files to diffs. Second,
this plumbs through the tip revision for each file to the diff method so
that we can include it in the file headers. This was important when
posting submitted changesets so that we would have revision information
for the modified file as well as the original.

  • Posted a variety of submitted and pending changesets, including binary
    files.
  • Verified that the revision information for modified files was present
    in the diff headers when posting submitted changesets.
  • Ran unit tests.
Summary ID
Add get_file_content APIs for Perforce and improve revision range diffs.
This change makes two improvements to the Perforce client backend in RBTools. First, this implements the new get_file_content and get_file_size APIs for use with uploading binary files to diffs. Second, this plumbs through the tip revision for each file to the diff method so that we can include it in the file headers. This was important when posting submitted changesets so that we would have revision information for the modified file as well as the original. Testing Done: - Posted a variety of submitted and pending changesets, including binary files. - Verified that the revision information for modified files was present in the diff headers when posting submitted changesets. - Ran unit tests.
4fed98549a6a3a25826f2bc66273985fc44736f3
Description From Last Updated

I know it's internal, but can you add Version Added to these? I've often found them useful when trying to …

chipx86chipx86

This could be an f-string.

chipx86chipx86

local variable 'content' is assigned to but never used Column: 13 Error code: F841

reviewbotreviewbot

local variable 'content' is assigned to but never used Column: 13 Error code: F841

reviewbotreviewbot
maubin
  1. Ship It!
  2. 
      
chipx86
  1. 
      
  2. rbtools/clients/perforce.py (Diff revision 1)
     
     
     
    Show all issues

    I know it's internal, but can you add Version Added to these? I've often found them useful when trying to backport code or diagnose things for customers. Gives me a starting point when trying to figure out where things originated.

  3. rbtools/clients/perforce.py (Diff revision 1)
     
     
    Show all issues

    This could be an f-string.

  4. 
      
david
david
Review request changed
Change Summary:

Add unit tests for new APIs

Commits:
Summary ID
Add get_file_content APIs for Perforce and improve revision range diffs.
This change makes two improvements to the Perforce client backend in RBTools. First, this implements the new get_file_content and get_file_size APIs for use with uploading binary files to diffs. Second, this plumbs through the tip revision for each file to the diff method so that we can include it in the file headers. This was important when posting submitted changesets so that we would have revision information for the modified file as well as the original. Testing Done: - Posted a variety of submitted and pending changesets, including binary files. - Verified that the revision information for modified files was present in the diff headers when posting submitted changesets. - Ran unit tests.
032657fcad316fd6645b7361a6475922ee9610f1
Add get_file_content APIs for Perforce and improve revision range diffs.
This change makes two improvements to the Perforce client backend in RBTools. First, this implements the new get_file_content and get_file_size APIs for use with uploading binary files to diffs. Second, this plumbs through the tip revision for each file to the diff method so that we can include it in the file headers. This was important when posting submitted changesets so that we would have revision information for the modified file as well as the original. Testing Done: - Posted a variety of submitted and pending changesets, including binary files. - Verified that the revision information for modified files was present in the diff headers when posting submitted changesets. - Ran unit tests.
9f33650e5163251f25ba0c8d9c352829457820fe

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

david
chipx86
  1. Ship It!
  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (c22baac)