Add a standard function for correctly applying a patch.
Review Request #12087 — Created Feb. 25, 2022 and submitted
This introduces
File.apply_patch()
, which will apply patched file
content to the filesystem for full-repository tools. This takes care of
properly applying not just added/modified changes (which worked fine
before) but deleted, moved, and copied files (which didn't).In the future, we may want to switch this to applying a patch through
GNU patch, to take advanage of time-tested patching logic. For now,
that's not how Review Bot works, so we're mimicking the logic we most
need for our tools.
New unit tests pass.
- Change Summary:
-
Removed unused variables.
- Commits:
-
Summary ID 905617d7d21c472cd24d77095b426ecdc0d6ee1a b0f818becccd983a0ef3a3b43fb961a6239a2819
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.
- Change Summary:
-
Added the missing working directory to the call to
apply_patch()
. - Commits:
-
Summary ID b0f818becccd983a0ef3a3b43fb961a6239a2819 039fdb3d7bafd0d9055a8c959e80ca71d42e3402
Checks run (2 succeeded)
flake8
passed.
JSHint
passed.