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

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


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