diff options
author | Konsta Holtta <kholtta@nvidia.com> | 2018-08-21 04:18:03 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-08-21 13:03:01 -0400 |
commit | bf8a1e0019d032928f6cdf44da59ebc4874047e0 (patch) | |
tree | 9255d1735643c40d6298322bf6de423611c5c860 /scripts | |
parent | fec299954f0c22123d0dd5d67613bf9f633b5fa0 (diff) |
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 <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1768066
GVS: Gerrit_Virtual_Submit
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/rfr | 10 |
1 files 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 @@ | |||
5 | 5 | ||
6 | import os | 6 | import os |
7 | import re | 7 | import re |
8 | import sys | ||
9 | import json | 8 | import json |
10 | import argparse | 9 | import argparse |
11 | import tempfile | 10 | import tempfile |
@@ -63,6 +62,9 @@ Otherwise it's treated as a git commit ID. | |||
63 | help='Specify the email\'s subject.') | 62 | help='Specify the email\'s subject.') |
64 | parser.add_argument('-R', '--sender', action='store', default=None, | 63 | parser.add_argument('-R', '--sender', action='store', default=None, |
65 | help='Specify a special from: email address.') | 64 | help='Specify a special from: email address.') |
65 | parser.add_argument('-t', '--to', action='append', default=[], | ||
66 | help='Specify an additional To: email address. ' | ||
67 | 'Can be repeated (-t a -t b).') | ||
66 | 68 | ||
67 | # Positionals: the gerrit URLs. | 69 | # Positionals: the gerrit URLs. |
68 | parser.add_argument('commits', metavar='Commit-IDs', | 70 | parser.add_argument('commits', metavar='Commit-IDs', |
@@ -277,13 +279,15 @@ def email_commits(commits_info, sender, subject, args): | |||
277 | else: | 279 | else: |
278 | msg = MIMEText(body) | 280 | msg = MIMEText(body) |
279 | 281 | ||
280 | msg['To'] = to_addr | 282 | to_addrs = [to_addr] + args.to |
283 | |||
284 | msg['To'] = ", ".join(to_addrs) | ||
281 | msg['From'] = sender | 285 | msg['From'] = sender |
282 | msg['Subject'] = subject | 286 | msg['Subject'] = subject |
283 | 287 | ||
284 | s = smtplib.SMTP('mail.nvidia.com') | 288 | s = smtplib.SMTP('mail.nvidia.com') |
285 | s.sendmail(sender, | 289 | s.sendmail(sender, |
286 | [to_addr], | 290 | to_addrs, |
287 | msg.as_string()) | 291 | msg.as_string()) |
288 | s.quit() | 292 | s.quit() |
289 | 293 | ||