Fish Trophy

chipx86 got a fish trophy!

Fish Trophy

Add a Patcher class for handling the application of patches.

Review Request #14041 — Created July 14, 2024 and updated

Information

RBTools
release-5.x

Reviewers

The new Patcher class is responsible for taking a list of patches and
applying or reverting them, optionally committing them as well.

Consumers of Patcher are expected to provide the list of patches to
apply (each being a Patch object), the destination path (optionally),
any information known about the repository, and flags to initiate a
revert or squash of the patches.

If the patches are to be committed, they're then expected to call
prepare_for_commit(). Then, patch() can be called.

Patcher.patch() is a generator, taking care to apply each patch in
order and yielding a successful result for each or raising an exception.
Consumers can use the generator nature of this tool to help with
progress reporting.

By default, this interfaces with the local patch tool, supporting both
GNU Patch and Apple/BSD Patch. It takes care to examine output for both
tools and convert them into suitable responses. Subclasses can override
the methods to instead interface with SCM-specific patching tools, and
to even take care to apply or commit multiple patches in one go instead
of individually (which is needed for Mercurial).

Follow-up changes will begin integrating Patcher into the SCMs and
into rbt patch and rbt land.

Unit tests pass.

Summary ID
Add a Patcher class for handling the application of patches.
The new `Patcher` class is responsible for taking a list of patches and applying or reverting them, optionally committing them as well. Consumers of `Patcher` are expected to provide the list of patches to apply (each being a `Patch` object), the destination path (optionally), any information known about the repository, and flags to initiate a revert or squash of the patches. If the patches are to be committed, they're then expected to call `prepare_for_commit()`. Then, `patch()` can be called. `Patcher.patch()` is a generator, taking care to apply each patch in order and yielding a successful result for each or raising an exception. Consumers can use the generator nature of this tool to help with progress reporting. By default, this interfaces with the local `patch` tool, supporting both GNU Patch and Apple/BSD Patch. It takes care to examine output for both tools and convert them into suitable responses. Subclasses can override the methods to instead interface with SCM-specific patching tools, and to even take care to apply or commit multiple patches in one go instead of individually (which is needed for Mercurial). Follow-up changes will begin integrating `Patcher` into the SCMs and into `rbt patch` and `rbt land`.
01e6e01543afe4fb5ce8d17b129b8202338e6da4
Description From Last Updated

'rbtools.api.resource.Resource' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'rbtools.utils.filesystem.make_tempfile' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

'rbtools.utils.filesystem.make_tempfile' imported but unused Column: 1 Error code: F401

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

reviewbotreviewbot

undefined name 'make_tempdir' Column: 23 Error code: F821

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

flake8

chipx86
Review request changed
Change Summary:

Removed unused imports.

Commits:
Summary ID
Add a Patcher class for handling the application of patches.
The new `Patcher` class is responsible for taking a list of patches and applying or reverting them, optionally committing them as well. Consumers of `Patcher` are expected to provide the list of patches to apply (each being a `Patch` object), the destination path (optionally), any information known about the repository, and flags to initiate a revert or squash of the patches. If the patches are to be committed, they're then expected to call `prepare_for_commit()`. Then, `patch()` can be called. `Patcher.patch()` is a generator, taking care to apply each patch in order and yielding a successful result for each or raising an exception. Consumers can use the generator nature of this tool to help with progress reporting. By default, this interfaces with the local `patch` tool, supporting both GNU Patch and Apple/BSD Patch. It takes care to examine output for both tools and convert them into suitable responses. Subclasses can override the methods to instead interface with SCM-specific patching tools, and to even take care to apply or commit multiple patches in one go instead of individually (which is needed for Mercurial). Follow-up changes will begin integrating `Patcher` into the SCMs and into `rbt patch` and `rbt land`.
0e7015b5503d8d57917cd2356c492395452e0ca1
Add a Patcher class for handling the application of patches.
The new `Patcher` class is responsible for taking a list of patches and applying or reverting them, optionally committing them as well. Consumers of `Patcher` are expected to provide the list of patches to apply (each being a `Patch` object), the destination path (optionally), any information known about the repository, and flags to initiate a revert or squash of the patches. If the patches are to be committed, they're then expected to call `prepare_for_commit()`. Then, `patch()` can be called. `Patcher.patch()` is a generator, taking care to apply each patch in order and yielding a successful result for each or raising an exception. Consumers can use the generator nature of this tool to help with progress reporting. By default, this interfaces with the local `patch` tool, supporting both GNU Patch and Apple/BSD Patch. It takes care to examine output for both tools and convert them into suitable responses. Subclasses can override the methods to instead interface with SCM-specific patching tools, and to even take care to apply or commit multiple patches in one go instead of individually (which is needed for Mercurial). Follow-up changes will begin integrating `Patcher` into the SCMs and into `rbt patch` and `rbt land`.
b3848722303ff5757511497660d9d1530fa25e14

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

chipx86
Review request changed
Change Summary:

Removed the correct unused import.

Commits:
Summary ID
Add a Patcher class for handling the application of patches.
The new `Patcher` class is responsible for taking a list of patches and applying or reverting them, optionally committing them as well. Consumers of `Patcher` are expected to provide the list of patches to apply (each being a `Patch` object), the destination path (optionally), any information known about the repository, and flags to initiate a revert or squash of the patches. If the patches are to be committed, they're then expected to call `prepare_for_commit()`. Then, `patch()` can be called. `Patcher.patch()` is a generator, taking care to apply each patch in order and yielding a successful result for each or raising an exception. Consumers can use the generator nature of this tool to help with progress reporting. By default, this interfaces with the local `patch` tool, supporting both GNU Patch and Apple/BSD Patch. It takes care to examine output for both tools and convert them into suitable responses. Subclasses can override the methods to instead interface with SCM-specific patching tools, and to even take care to apply or commit multiple patches in one go instead of individually (which is needed for Mercurial). Follow-up changes will begin integrating `Patcher` into the SCMs and into `rbt patch` and `rbt land`.
b3848722303ff5757511497660d9d1530fa25e14
Add a Patcher class for handling the application of patches.
The new `Patcher` class is responsible for taking a list of patches and applying or reverting them, optionally committing them as well. Consumers of `Patcher` are expected to provide the list of patches to apply (each being a `Patch` object), the destination path (optionally), any information known about the repository, and flags to initiate a revert or squash of the patches. If the patches are to be committed, they're then expected to call `prepare_for_commit()`. Then, `patch()` can be called. `Patcher.patch()` is a generator, taking care to apply each patch in order and yielding a successful result for each or raising an exception. Consumers can use the generator nature of this tool to help with progress reporting. By default, this interfaces with the local `patch` tool, supporting both GNU Patch and Apple/BSD Patch. It takes care to examine output for both tools and convert them into suitable responses. Subclasses can override the methods to instead interface with SCM-specific patching tools, and to even take care to apply or commit multiple patches in one go instead of individually (which is needed for Mercurial). Follow-up changes will begin integrating `Patcher` into the SCMs and into `rbt patch` and `rbt land`.
01e6e01543afe4fb5ce8d17b129b8202338e6da4

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
david
  1. Ship It!
  2.