Consolidate keyword argument building for diff() calls.

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

Information

RBTools
release-3.x

Reviewers

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.

Diff Revision 2

This is not the most recent revision of the diff. The latest diff is revision 3. See what's changed.

orig
1
2
3

Commits

First Last Summary ID Author
Consolidate keyword argument building for diff() calls.
`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.
33df95e8c2194aed241a6d491bc07bf7e4429b30 Christian Hammond
rbtools/commands/post.py
Loading...