summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristof Beyls <kristof.beyls@arm.com>2018-06-29 07:16:27 +0000
committerKristof Beyls <kristof.beyls@arm.com>2018-06-29 07:16:27 +0000
commit63e68acbc3a2f819f9fb1774e232127367b667cb (patch)
treeb301624aa1ceb0e63d9c508f375a8a9e542c1772
parentc0826745cfdc9a2a4d10c676af2210f7103108eb (diff)
downloadbcm5719-llvm-63e68acbc3a2f819f9fb1774e232127367b667cb.tar.gz
bcm5719-llvm-63e68acbc3a2f819f9fb1774e232127367b667cb.zip
Make email options of find_interesting_reviews more flexible.
This enables a few requested improvements on the original review of this script at https://reviews.llvm.org/D46192. This introduces 2 new command line options: * --email-report: This option enables specifying who to email the generated report to. This also enables not sending any email and only printing out the report on stdout by not specifying this option on the command line. * --sender: this allows specifying the email address that will be used in the "From" email header. I believe that with these options the script starts having the basic features needed to run it well on a regular basis for a group of developers. Differential Revision: https://reviews.llvm.org/D47930 llvm-svn: 335948
-rw-r--r--llvm/utils/Reviewing/find_interesting_reviews.py29
1 files changed, 23 insertions, 6 deletions
diff --git a/llvm/utils/Reviewing/find_interesting_reviews.py b/llvm/utils/Reviewing/find_interesting_reviews.py
index 31d5641e3d0..5af462b54a9 100644
--- a/llvm/utils/Reviewing/find_interesting_reviews.py
+++ b/llvm/utils/Reviewing/find_interesting_reviews.py
@@ -554,17 +554,17 @@ def update_git_repos():
output = get_git_cmd_output(cmd)
-def send_emails(email_addresses, msg):
+def send_emails(email_addresses, sender, msg):
s = smtplib.SMTP()
s.connect()
for email_address in email_addresses:
email_msg = email.mime.multipart.MIMEMultipart()
- email_msg['From'] = ''
+ email_msg['From'] = sender
email_msg['To'] = email_address
email_msg['Subject'] = 'LLVM patches you may be able to review.'
- email_msg.attach(email.mime.text.MIMEText(msg, 'plain'))
+ email_msg.attach(email.mime.text.MIMEText(msg.encode('utf-8'), 'plain'))
# python 3.x: s.send_message(email_msg)
- s.sendmail(email_msg['From'], email_msg['To'], msg)
+ s.sendmail(email_msg['From'], email_msg['To'], email_msg.as_string())
s.quit()
@@ -585,7 +585,19 @@ def main():
default=True,
help='Do not update cached Phabricator objects')
parser.add_argument(
- 'email_addresses',
+ '--email-report',
+ dest='email_report',
+ nargs='*',
+ default="",
+ help="A email addresses to send the report to.")
+ parser.add_argument(
+ '--sender',
+ dest='sender',
+ default="",
+ help="The email address to use in 'From' on messages emailed out.")
+ parser.add_argument(
+ '--email-addresses',
+ dest='email_addresses',
nargs='*',
help="The email addresses (as known by LLVM git) of " +
"the people to look for reviews for.")
@@ -597,6 +609,9 @@ def main():
logging.basicConfig(level=logging.DEBUG)
people_to_look_for = [e.decode('utf-8') for e in args.email_addresses]
+ logging.debug("Will look for reviews that following contributors could " +
+ "review: {}".format(people_to_look_for))
+ logging.debug("Will email a report to: {}".format(args.email_report))
phab = init_phab_connection()
@@ -609,7 +624,9 @@ def main():
phab,
days=1,
filter_reviewers=filter_reviewers_to_report_for(people_to_look_for))
- send_emails(people_to_look_for, msg)
+
+ if args.email_report != []:
+ send_emails(args.email_report, args.sender, msg)
if __name__ == "__main__":
OpenPOWER on IntegriCloud