Update rbt patch for typing, the new Patch class, and crash fixes.

Review Request #13970 — Created June 10, 2024 and submitted

Information

RBTools
release-5.x

Reviewers

rbt patch now has type hints all throughout. This helped catch some
places where we were mixing types, leading to crashes. Notably, JSON
output would crash when dealing with conflicting files represented as
Unicode strings (which are expectd due to the type hints) rather than
byte strings.

It now uses the Patch class to track patches to apply, wrapped by a
small PendingPatchInfo dictionary with the rest of the information
that it needs to track.

This is in preparation for using new patching logic for more SCM-driven
patch application, which is in development now.

As a note, the Patch command has been renamed to PatchCommand, to
avoid conflicts with the Patch class. This will require those using
the development tree to re-run pip install -e . to register the new
entrypoint.


 
Summary ID
Update rbt patch for typing, the new Patch class, and crash fixes.
`rbt patch` now has type hints all throughout. This helped catch some places where we were mixing types, leading to crashes. Notably, JSON output would crash when dealing with conflicting files represented as Unicode strings (which are expectd due to the type hints) rather than byte strings. It now uses the `Patch` class to track patches to apply, wrapped by a small `PendingPatchInfo` dictionary with the rest of the information that it needs to track. This is in preparation for using new patching logic for more SCM-driven patch application, which is in development now. As a note, the `Patch` command has been renamed to `PatchCommand`, to avoid conflicts with the `Patch` class. This will require those using the development tree to re-run `pip install -e .` to register the new entrypoint.
3517d8ff4c0d0123a8e135f6c327c4e4ac18ded5
Description From Last Updated

You define patch_output here, forgot to use it in the conditional, and then redefine it.

maubinmaubin
david
  1. Ship It!
  2. 
      
maubin
  1. 
      
  2. rbtools/commands/patch.py (Diff revision 1)
     
     
     
     
     
     
     
    Show all issues

    You define patch_output here, forgot to use it in the conditional, and then redefine it.

  3. 
      
chipx86
david
  1. Ship It!
  2. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-5.x (1e886a2)