Add a new Patch class for representing patches to apply.

Review Request #13969 — Created June 10, 2024 and updated

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.

Summary ID
Add a new Patch class for representing patches to apply.
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. Currently, `Patch` isn't being used, but it will form a key part of the upcoming work on how patches get applied to repositories.
b15a961fe0217762f9b8a4c2b7f23bba81034e10
Description From Last Updated

Looks like there's an extra #: here.

maubinmaubin

Looks like there's an extra #: here.

maubinmaubin
chipx86
chipx86
Review request changed
david
  1. Ship It!
  2. 
      
maubin
  1. 
      
  2. rbtools/diffs/patches.py (Diff revision 2)
     
     
    Show all issues

    Looks like there's an extra #: here.

  3. rbtools/diffs/patches.py (Diff revision 2)
     
     
    Show all issues

    Looks like there's an extra #: here.

  4.