From 138adb3faf9b5c622100169c2518f5d9e81672bb Mon Sep 17 00:00:00 2001 From: Konstantin Ryabitsev Date: Mon, 22 Aug 2022 13:37:35 -0400 Subject: ez: allow defining commands for getting To: and Cc: addresses We will still use get_maintainer.pl if we find it, but it is now possible to override it with send-auto-to-cmd and send-auto-cc-cmd config values. Signed-off-by: Konstantin Ryabitsev --- b4/ez.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/b4/ez.py b/b4/ez.py index d1f1040..a175a33 100644 --- a/b4/ez.py +++ b/b4/ez.py @@ -973,16 +973,22 @@ def cmd_send(cmdargs: argparse.Namespace) -> None: if not cmdargs.no_auto_to_cc: logger.info('Populating the To: and Cc: fields with automatically collected addresses') - # Use a sane tocmd and cccmd for the kernel - # TODO: make it definable in the config + topdir = b4.git_get_toplevel() + # Use sane tocmd and cccmd defaults if we find a get_maintainer.pl tocmdstr = tocmd = None cccmdstr = cccmd = None - topdir = b4.git_get_toplevel() getm = os.path.join(topdir, 'scripts', 'get_maintainer.pl') - if os.access(getm, os.X_OK): - logger.info('Using kernel get_maintainer.pl for to and cc lists') + if config.get('send-auto-to-cmd'): + tocmdstr = config.get('send-auto-to-cmd') + elif os.access(getm, os.X_OK): + logger.info('Invoking get_maintainer.pl for To: addresses') tocmdstr = f'{getm} --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nol' + if config.get('send-auto-cc-cmd'): + cccmdstr = config.get('send-auto-cc-cmd') + elif os.access(getm, os.X_OK): + logger.info('Invoking get_maintainer.pl for Cc: addresses') cccmdstr = f'{getm} --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nom' + if tocmdstr: sp = shlex.shlex(tocmdstr, posix=True) sp.whitespace_split = True -- cgit v1.2.3