Fix a regression with rbt patch --write/--print, plus a newline fix.

Review Request #14247 — Created Nov. 13, 2024 and submitted

Information

RBTools
release-5.x

Reviewers

When setting up state for rbt patch, we only query local repository
information if we're going to be applying patches. If we're just
fetching a patch for display or to output to a file, we skip this step.
This then breaks due to an expectation that that state has been set.

We're now more careful about the checks and assumptions surrounding the
repository state, ensuring both cases will work.

There's also a fix for an extra newline that would appear in the patch
output. We no longer unconditionally output a newline after outputting a
patch. Instead, we only output one if the patch does not contain one.

Tested rbt patch, rbt patch --write, and rbt patch --print.

Verified the extra newline is gone.

Summary ID
Fix a regression with rbt patch --write/--print, plus a newline fix.
When setting up state for `rbt patch`, we only query local repository information if we're going to be applying patches. If we're just fetching a patch for display or to output to a file, we skip this step. This then breaks due to an expectation that that state has been set. We're now more careful about the checks and assumptions surrounding the repository state, ensuring both cases will work. There's also a fix for an extra newline that would appear in the patch output. We no longer unconditionally output a newline after outputting a patch. Instead, we only output one if the patch does not contain one.
a6708302d2637134ebeabc8aa22509e542c86980
Description From Last Updated

We could pull out patch.content into a variable.

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

    We could pull out patch.content into a variable.

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