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

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

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.

Commits

Files