Add history support in rbt attach, and enhance JSON output.

Review Request #12164 — Created March 17, 2022 and submitted

Information

RBTools
master

Reviewers

This provides a couple of much-needed improvements to rbt attach.
It now supports --attachment-history-id=, which allows for specifying
the ID of a file attachment history object that should own the file
attachment. This enables callers to replace file attachments, if they
know the ID, and to set up diffing.

That's perhaps more useful for automation, so to help with that, the
JSON output has been enhanced to provide a lot more information about
the resulting attachment. This includes:

  • File attachment ID
  • File attachment History ID
  • Revision
  • Caption
  • Stored filename
  • Mimetype
  • Download URL
  • Review request URL
  • Review UI URL

This should be enough for automated tooling to begin operating on the
attachment further.

Along with this, the attached_file key in the JSON output is now
guaranteed to be an absolute path, which is better for automated tools.

Tested rbt attach with the new JSON output, with a combination of
arguments (with/without --caption and --filename).

Tested the payload with errors (invalid review request ID, filename).

Tested attaching with an attachment history ID and getting the new
revision.

Summary ID
Add history support in rbt attach, and enhance JSON output.
This provides a couple of much-needed improvements to `rbt attach`. It now supports `--attachment-history-id=`, which allows for specifying the ID of a file attachment history object that should own the file attachment. This enables callers to replace file attachments, if they know the ID, and to set up diffing. That's perhaps more useful for automation, so to help with that, the JSON output has been enhanced to provide a lot more information about the resulting attachment. This includes: * File attachment ID * File attachment History ID * Revision * Caption * Stored filename * Mimetype * Download URL * Review request URL * Review UI URL This should be enough for automated tooling to begin operating on the attachment further.
c5e5da40e69525a84d07c74ddd94cb8b0023982c
Description From Last Updated

If this is truly for master (rbtools 4.0), just import from urllib.parse. I'll be updating things to do that everywhere …

daviddavid
david
  1. 
      
  2. rbtools/commands/attach.py (Diff revision 1)
     
     

    If this is truly for master (rbtools 4.0), just import from urllib.parse. I'll be updating things to do that everywhere soon.

    1. Actually, I'm getting the sense that these are all for release-3.x (probably we just need to update .reviewboardrc).

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

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (c89e055)
Loading...