From 6d8abb347af380dab9c7952260622f955d86c995 Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 22 Aug 2022 13:30:21 -0400 Subject: ez: allow passing --since to b4 trailers Reduce the default range to 1.month and allow overriding with other values when trying to update trailers from arbitrary ML threads. Signed-off-by: Konstantin Ryabitsev --- b4/command.py | 6 ++++-- b4/ez.py | 11 ++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/b4/command.py b/b4/command.py index 25615e3..af2ce65 100644 --- a/b4/command.py +++ b/b4/command.py @@ -274,12 +274,14 @@ def cmd(): sp_trl = subparsers.add_parser('trailers', help='Operate on trailers received for mailing list reviews') sp_trl.add_argument('-u', '--update', action='store_true', default=False, help='Update branch commits with latest received trailers') - sp_trl.add_argument('-F', '--trailers-from', dest='msgid', - help='Look for trailers in the thread with this msgid instead of using the series change-id') sp_trl.add_argument('-s', '--signoff', action='store_true', default=False, help='Add my Signed-off-by trailer, if not already present') sp_trl.add_argument('-S', '--sloppy-trailers', dest='sloppytrailers', action='store_true', default=False, help='Apply trailers without email address match checking') + sp_trl.add_argument('-F', '--trailers-from', dest='msgid', + help='Look for trailers in the thread with this msgid instead of using the series change-id') + sp_trl.add_argument('--since', default='1.month', + help='The --since option to use with -F when auto-matching patches (default=1.month)') sp_trl.set_defaults(func=cmd_trailers) # b4 send diff --git a/b4/ez.py b/b4/ez.py index 05b9081..d1f1040 100644 --- a/b4/ez.py +++ b/b4/ez.py @@ -86,7 +86,7 @@ def get_auth_configs() -> Tuple[str, str, str, str, str, str]: return endpoint, myname, myemail, selector, algo, keydata -def auth_new(cmdargs: argparse.Namespace) -> None: +def auth_new() -> None: try: endpoint, myname, myemail, selector, algo, keydata = get_auth_configs() except patatt.NoKeyError as ex: @@ -430,7 +430,6 @@ def load_cover(strip_comments: bool = False) -> Tuple[str, dict]: tracking = json.loads(bcfg.get('b4-tracking', '{}')) else: - # TODO: implement logger.critical('Not yet supported for %s cover strategy', strategy) sys.exit(0) @@ -624,8 +623,6 @@ def update_trailers(cmdargs: argparse.Namespace) -> None: ignore_commits = None # If we are in an b4-prep branch, we start from the beginning of the series - # oterwise, we start at the first commit where we're the committer since 3.months - # TODO: consider making that settable? if is_prep_branch(): start = get_series_start() end = 'HEAD' @@ -642,9 +639,9 @@ def update_trailers(cmdargs: argparse.Namespace) -> None: changeid = None myemail = usercfg['email'] # There doesn't appear to be a great way to find the first commit - # where we're NOT the committer, so we get all commits since "3.months" where + # where we're NOT the committer, so we get all commits since range specified where # we're the committer and stop at the first non-contiguous parent - gitargs = ['log', '-F', f'--committer={myemail}', '--since=3.months', '--format=%H %P'] + gitargs = ['log', '-F', f'--committer={myemail}', '--since', cmdargs.since, '--format=%H %P'] lines = b4.git_get_command_lines(None, gitargs) if not lines: logger.critical('CRITICAL: could not find any commits where committer=%s', myemail) @@ -922,7 +919,7 @@ def format_patch(output_dir: str) -> None: def cmd_send(cmdargs: argparse.Namespace) -> None: if cmdargs.auth_new: - auth_new(cmdargs) + auth_new() return if cmdargs.auth_verify: auth_verify(cmdargs) -- cgit v1.2.3