@@ -317,6 +317,8 @@ def setup_parser() -> argparse.ArgumentParser:
help='Send everything to yourself instead of the actual recipients')
sp_send.add_argument('--no-trailer-to-cc', action='store_true', default=False,
help='Do not add any addresses found in the cover or patch trailers to To: or Cc:')
+ sp_send.add_argument('--per-patch-to-cc', action='store_true', default=False,
+ help='Invoke individual tocmd, cccmd for each patch')
sp_send.add_argument('--to', nargs='+', help='Addresses to add to the To: list')
sp_send.add_argument('--cc', nargs='+', help='Addresses to add to the Cc: list')
sp_send.add_argument('--not-me-too', action='store_true', default=False,
@@ -1557,8 +1557,18 @@ def cmd_send(cmdargs: argparse.Namespace) -> None:
if not cl_msgid:
cl_msgid = b4.LoreMessage.get_clean_msgid(msg)
- myto = list(allto)
- mycc = list(allcc)
+ myto = list()
+ mycc = list()
+ if cmdargs.per_patch_to_cc and commit:
+ tocmd = get_to_cmd()
+ cccmd = get_cc_cmd()
+ msgbytes = msg.as_bytes()
+ myto = get_addresses_from_cmd(tocmd, msgbytes)
+ mycc = get_addresses_from_cmd(cccmd, msgbytes)
+ else:
+ myto = list(allto)
+ mycc = list(allcc)
+
if msg['To']:
myto += email.utils.getaddresses([msg['To']])
if msg['Cc']:
@@ -2053,6 +2063,43 @@ def compare(compareto: str) -> None:
logger.debug('Running %s', ' '.join(grdcmd))
os.execvp(grdcmd[0], grdcmd)
+def get_to_cmd():
+ tocmdstr = None
+ topdir = b4.git_get_toplevel()
+ # Use sane tocmd and cccmd defaults if we find a get_maintainer.pl
+ getm = os.path.join(topdir, 'scripts', 'get_maintainer.pl')
+ config = b4.get_main_config()
+ if config.get('send-auto-to-cmd'):
+ tocmdstr = config.get('send-auto-to-cmd')
+ elif os.access(getm, os.X_OK):
+ tocmdstr = f'{getm} --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nol'
+
+ tocmd = list()
+ if tocmdstr:
+ sp = shlex.shlex(tocmdstr, posix=True)
+ sp.whitespace_split = True
+ tocmd = list(sp)
+
+ return tocmd
+
+def get_cc_cmd():
+ cccmdstr = None
+ topdir = b4.git_get_toplevel()
+ # Use sane tocmd and cccmd defaults if we find a get_maintainer.pl
+ getm = os.path.join(topdir, 'scripts', 'get_maintainer.pl')
+ config = b4.get_main_config()
+ if config.get('send-auto-cc-cmd'):
+ cccmdstr = config.get('send-auto-cc-cmd')
+ elif os.access(getm, os.X_OK):
+ cccmdstr = f'{getm} --nogit --nogit-fallback --nogit-chief-penguins --norolestats --nom'
+
+ cccmd = list()
+ if cccmdstr:
+ sp = shlex.shlex(cccmdstr, posix=True)
+ sp.whitespace_split = True
+ cccmd = list(sp)
+
+ return cccmd
def auto_to_cc() -> None:
tocmdstr = None
Add "--per-patch-to-cc" option to send command to allow invoking cccmd and tocmd individually per patch - this is usefull when sending series to multiply subsystems. Cover letter will still includes To: and Cc: gathered by "prep --auto-to-cc". Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me> --- This makes b4 act as an old cocci_cc script, we gather emails by --auto-to-cc, but then we can select email individually for each commit. --- b4/command.py | 2 ++ b4/ez.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 51 insertions(+), 2 deletions(-)