Add a standard function for correctly applying a patch.

Review Request #12087 — Created Feb. 25, 2022 and submitted — Latest diff uploaded

Information

ReviewBot
release-3.0.x

Reviewers

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.

Diff Revision 3

This is not the most recent revision of the diff. The latest diff is revision 4. See what's changed.

orig
1
2
3
4

Commits

First Last Summary ID Author
Add a standard function for correctly applying a patch.
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.
039fdb3d7bafd0d9055a8c959e80ca71d42e3402 Christian Hammond
bot/reviewbot/processing/review.py
bot/reviewbot/processing/tests/test_file.py
bot/reviewbot/tools/base/mixins.py
Loading...