Add a new Patch class for representing patches to apply.

Review Request #13969 — Created June 10, 2024 and submitted — Latest diff uploaded

Information

RBTools
release-5.x

Reviewers

The new rbtools.diffs.patches.Patch represents a patch that can be
applied to a source tree. It consists of patch content or a patch file
path, along with optional information needed to apply the patch, such as
the commit author and message, base directory, and path prefix strip
level.

To access the contents of a Patch, you first call open(). This is a
context manager that ensures you can get to the content or file path,
and that any temporary state is then cleaned up after use.

A Patch can also be assigned to a PatchResult. This is optional,
but will let a receiver of a PatchResult access information on the
underlying Patch.

Currently, Patch isn't being used, but it will form a key part of the
upcoming work on how patches get applied to repositories.

Unit tests pass.

Tested this in some in-progress patching code.

Commits

Files