• 
      

    Consolidate keyword argument building for diff() calls.

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

    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.

    Summary ID
    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.
    22fee3ea2894a2ed4a1dddc0ee75e55129c980ec
    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:
    Completed
    Change Summary:
    Pushed to release-3.x (b5fb7e0)