Add a new Patch class for representing patches to apply.
Review Request #13969 — Created June 10, 2024 and submitted
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 callopen()
. 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 aPatchResult
. This is optional,
but will let a receiver of aPatchResult
access information on the
underlyingPatch
.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.