mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
gpu: nvgpu: rfr: Add support for CCs
Add support for CCs instead of only direct To addresses. This lets us have more fine grained control over the to/cc addresses. [Bump minor revision to 1.0.3] Change-Id: Ie2864ddde02a71a4502bf2b3d0d80064810da0ef Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1983663 Reviewed-by: Rohit Khanna <rokhanna@nvidia.com>
This commit is contained in:
committed by
Rohit Khanna
parent
e2aa359774
commit
67138e0376
29
scripts/rfr
29
scripts/rfr
@@ -33,7 +33,10 @@ import smtplib
|
|||||||
|
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
|
|
||||||
VERSION = '1.0.2'
|
VERSION = '1.0.3'
|
||||||
|
|
||||||
|
# Default email address.
|
||||||
|
to_addr = 'SW-Mobile-nvgpu-core <SW-Mobile-nvgpu-core@exchange.nvidia.com>'
|
||||||
|
|
||||||
# Gerrit commit URL formats. These are regular expressions to match the
|
# Gerrit commit URL formats. These are regular expressions to match the
|
||||||
# incoming URLs against.
|
# incoming URLs against.
|
||||||
@@ -85,6 +88,9 @@ Otherwise it's treated as a git commit ID.
|
|||||||
parser.add_argument('-t', '--to', action='append', default=[],
|
parser.add_argument('-t', '--to', action='append', default=[],
|
||||||
help='Specify an additional To: email address.'
|
help='Specify an additional To: email address.'
|
||||||
'Can be repeated (-t a -t b).')
|
'Can be repeated (-t a -t b).')
|
||||||
|
parser.add_argument('-c', '--cc', action='append', default=[],
|
||||||
|
help='Specify an additional Cc: email address.'
|
||||||
|
'Can be repeated (-c a -c b).')
|
||||||
parser.add_argument('-F', '--file', action='store', default=None,
|
parser.add_argument('-F', '--file', action='store', default=None,
|
||||||
help='File with commits, one per line')
|
help='File with commits, one per line')
|
||||||
|
|
||||||
@@ -285,21 +291,26 @@ Thanks!
|
|||||||
extra_message=extra_message,
|
extra_message=extra_message,
|
||||||
cmt_verbose=cmt_verbose)
|
cmt_verbose=cmt_verbose)
|
||||||
|
|
||||||
def format_to_comment(to_addrs):
|
def format_msg_comment(subject, to_addrs, cc_addrs):
|
||||||
"""
|
"""
|
||||||
Take the list of to_addrs and format them into a comment so that the sender
|
Take the list of to_addrs and format them into a comment so that the sender
|
||||||
knows who they are sending an email to.
|
knows who they are sending an email to.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
to_comment = """# Lines that begin with a '#' will be ignored in the final
|
msg_comment = """# Lines that begin with a '#' will be ignored in the final
|
||||||
# message. This includes white space so ' # blah', for example,
|
# message. This includes white space so ' # blah', for example,
|
||||||
# will _not_ be ignored.
|
# will _not_ be ignored.
|
||||||
#
|
#
|
||||||
"""
|
"""
|
||||||
for addr in to_addrs:
|
|
||||||
to_comment += '# To: %s\n' % addr
|
|
||||||
|
|
||||||
return to_comment
|
msg_comment += '# Subject: %s\n' % subject
|
||||||
|
|
||||||
|
for addr in to_addrs:
|
||||||
|
msg_comment += '# To: %s\n' % addr
|
||||||
|
for addr in cc_addrs:
|
||||||
|
msg_comment += '# Cc: %s\n' % addr
|
||||||
|
|
||||||
|
return msg_comment
|
||||||
|
|
||||||
def display_commits(commits_info, extra_message):
|
def display_commits(commits_info, extra_message):
|
||||||
"""
|
"""
|
||||||
@@ -313,13 +324,14 @@ def email_commits(commits_info, sender, subject, args):
|
|||||||
Directly email commits to the nvgpu-core mailing list for review!
|
Directly email commits to the nvgpu-core mailing list for review!
|
||||||
"""
|
"""
|
||||||
|
|
||||||
to_addr = 'SW-Mobile-nvgpu-core <SW-Mobile-nvgpu-core@exchange.nvidia.com>'
|
|
||||||
to_addrs = [to_addr] + args.to
|
to_addrs = [to_addr] + args.to
|
||||||
|
cc_addrs = args.cc
|
||||||
|
|
||||||
if args.no_msg:
|
if args.no_msg:
|
||||||
args.msg = None
|
args.msg = None
|
||||||
|
|
||||||
body = format_to_comment(to_addrs) + format_commits(commits_info, args.msg)
|
body = format_msg_comment(subject, to_addrs, cc_addrs) + \
|
||||||
|
format_commits(commits_info, args.msg)
|
||||||
|
|
||||||
# Most people like to write a little description of their patch series
|
# Most people like to write a little description of their patch series
|
||||||
# in the email body. This aims to take care of that.
|
# in the email body. This aims to take care of that.
|
||||||
@@ -346,6 +358,7 @@ def email_commits(commits_info, sender, subject, args):
|
|||||||
msg = MIMEText(body)
|
msg = MIMEText(body)
|
||||||
|
|
||||||
msg['To'] = ", ".join(to_addrs)
|
msg['To'] = ", ".join(to_addrs)
|
||||||
|
msg['Cc'] = ", ".join(cc_addrs)
|
||||||
msg['From'] = sender
|
msg['From'] = sender
|
||||||
msg['Subject'] = subject
|
msg['Subject'] = subject
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user