From bf8a1e0019d032928f6cdf44da59ebc4874047e0 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 21 Aug 2018 11:18:03 +0300 Subject: scripts: rfr: support multiple recipients Add an argument (-t, --to) to specify additional recipients for the review email. Sometimes it's useful to highlight some people explicitly or in addition to the usual nvgpu core list. In the future, we might consider adding some heuristics for less typing (such as adding @nvidia.com automatically). For now the addresses have to be complete. Change-Id: I0e4ce5974a7a2f3db6eacc7128b825d20d6fd57c Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1768066 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- scripts/rfr | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/rfr b/scripts/rfr index 0d54d572..030a9895 100755 --- a/scripts/rfr +++ b/scripts/rfr @@ -5,7 +5,6 @@ import os import re -import sys import json import argparse import tempfile @@ -63,6 +62,9 @@ Otherwise it's treated as a git commit ID. help='Specify the email\'s subject.') parser.add_argument('-R', '--sender', action='store', default=None, help='Specify a special from: email address.') + parser.add_argument('-t', '--to', action='append', default=[], + help='Specify an additional To: email address. ' + 'Can be repeated (-t a -t b).') # Positionals: the gerrit URLs. parser.add_argument('commits', metavar='Commit-IDs', @@ -277,13 +279,15 @@ def email_commits(commits_info, sender, subject, args): else: msg = MIMEText(body) - msg['To'] = to_addr + to_addrs = [to_addr] + args.to + + msg['To'] = ", ".join(to_addrs) msg['From'] = sender msg['Subject'] = subject s = smtplib.SMTP('mail.nvidia.com') s.sendmail(sender, - [to_addr], + to_addrs, msg.as_string()) s.quit() -- cgit v1.2.2