Add support for writing patches to a file using rbt patch --write.

Review Request #11706 — Created July 6, 2021 and submitted

Information

RBTools
release-2.0.x

Reviewers

rbt patch can now write patches to a local file by passing
--write=<filename>. This works just like --print with a redirect to
a file, but avoids any possibility of unwanted output being written.

This cannot be used along with --print or --revert. Either will exit
early with an error.

This change is based on https://reviews.reviewboard.org/r/11676/ by
André Klitzing, and was updated to remove some legacy handling of diff
content Unicode strings and to rename the option from --file to
--write.

Tested --print, --write, and --print > filename on Python 2 and 3,
with diffs containing Unicode content. In all cases, the file content
was written/outputted correctly and consistently.

Tested that neither --write nor --print could be used with each other
or with --revert.

Summary ID
Add support for writing patches to a file using rbt patch --write.
`rbt patch` can now write patches to a local file by passing `--write=<filename>`. This works just like `--print` with a redirect to a file, but avoids any possibility of unwanted output being written. This cannot be used along with `--print` or `--revert`. Either will exit early with an error. This change is based on https://reviews.reviewboard.org/r/11676/ by André Klitzing, and was updated to remove some legacy handling of diff content Unicode strings and to rename the option from `--file` to `--write`.
b46df207e34c76e1e435436f1441dd69af5f3114
Description From Last Updated

Thanks! It works for me... but has one issue. $ rbt patch --write=dummy https://reviews.reviewboard.org/r/11706/ ERROR: Unable to find a Review …

miserymisery
david
  1. Ship It!
  2. 
      
misery
  1. 
      
  2. Show all issues

    Thanks! It works for me... but has one issue.

    $ rbt patch --write=dummy https://reviews.reviewboard.org/r/11706/
    ERROR: Unable to find a Review Board server for this source code tree.
    

    See: /r/11381/

    Work-Around

    $ rbt patch --write=dummy --server https://reviews.reviewboard.org https://reviews.reviewboard.org/r/11706/
    
  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-2.0.x (16bfc54)