Add support for writing patches to a file using rbt patch --write.
Review Request #11706 — Created July 6, 2021 and submitted — Latest diff uploaded
rbt patch
can now write patches to a local file by passing
--write=<filename>
. This works just like
a file, but avoids any possibility of unwanted output being written.This cannot be used along with
--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
--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
or with--revert
.