Message ID | 20230221-fix-base-commit-for-non-commit-strategies-v1-1-0e31f1333d76@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [b4] ez: get_series_details: correctly compute 'base_commit' for all strategies | expand |
On Tue, 21 Feb 2023 20:07:46 -0500, Philippe Blain wrote: > In f0fad6e (ez: refactor based on initial feedback, 2022-07-20), support > was added for the 'branch-description' strategy, but > 'get_series_details' was not changed to account for the fact that if the > cover letter is stored in the branch description, base_commit and > start_commit should be the same commit. > > This was also missed when 9e95d52 (ez: implement tip-commit strategy, > 2022-07-27) added support for the 'tip-commit' strategy and changed > get_series_details to adjust the end commit of the series. > > [...] Applied, thanks! [1/1] ez: get_series_details: correctly compute 'base_commit' for all strategies commit: 221cc6ccd40d3e643bc65b34f2fca72ad2a69363 Best regards,
diff --git a/b4/ez.py b/b4/ez.py index 74afddc..5f4d744 100644 --- a/b4/ez.py +++ b/b4/ez.py @@ -940,10 +940,13 @@ def get_addresses_from_cmd(cmdargs: List[str], msgbytes: bytes) -> List[Tuple[st def get_series_details(start_commit: Optional[str] = None) -> Tuple[str, str, str, List[str], str, str]: if not start_commit: start_commit = get_series_start() - gitargs = ['rev-parse', f'{start_commit}~1'] - lines = b4.git_get_command_lines(None, gitargs) - base_commit = lines[0] strategy = get_cover_strategy() + if strategy == 'commit': + gitargs = ['rev-parse', f'{start_commit}~1'] + lines = b4.git_get_command_lines(None, gitargs) + base_commit = lines[0] + else: + base_commit = start_commit if strategy == 'tip-commit': cover_commit = find_cover_commit() endrange = b4.git_revparse_obj(f'{cover_commit}~1')
In f0fad6e (ez: refactor based on initial feedback, 2022-07-20), support was added for the 'branch-description' strategy, but 'get_series_details' was not changed to account for the fact that if the cover letter is stored in the branch description, base_commit and start_commit should be the same commit. This was also missed when 9e95d52 (ez: implement tip-commit strategy, 2022-07-27) added support for the 'tip-commit' strategy and changed get_series_details to adjust the end commit of the series. Fix that by setting 'base_commit' to 'start_commit's parent only for the 'commit' strategy, and to 'start_commit' for other strategies. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> --- b4/ez.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- base-commit: ada3021c64dd484e53219eb3af55da6c8f25d0ec change-id: 20230221-fix-base-commit-for-non-commit-strategies-a0d6ef465d86 -- b4