Add a standard function for correctly applying a patch.

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

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.

Summary ID
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.
6ca7abffac8edd82f063c74cb45fdc0ff7928dd3
Description From Last Updated

F841 local variable 'docs_dir' is assigned to but never used

reviewbotreviewbot

F841 local variable 'docs_dir' is assigned to but never used

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
chipx86
david
  1. Ship It!

  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.0.x (c5bb722)