Consolidate keyword argument building for diff() calls.

Review Request #12238 — Created April 18, 2022 and submitted

chipx86
RBTools
release-3.x
rbtools

rbt post has a lot of duplication of logic when it comes to building
diffs. There are two functions responsible for diff building:
_get_diff_history() and _get_squashed_diff(). Both build the same
dictionary of common keyword arguments up-front. _get_diff_history()
then proceeds to make multiple diff() calls and passes in (and
re-computes) values for each call, rather than putting those into the
common dictionary.

This change introduces _build_get_diff_kwargs(), which computes all
actual common arguments. These functions then call them and pass the
results into each diff() call. This simplifies their code
considerably, and should help avoid issues in the future.

Tested posting squashed and history diffs for review locally. Posted
this change as well.

rbt post unit tests pass.

Summary
Consolidate keyword argument building for diff() calls.
Description From Last Updated

F841 local variable 'options' is assigned to but never used

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-3.x (b5fb7e0)
Loading...