[PATCH] D47930: Make email options of find_interesting_reviews more flexible.

Kristof Beyls via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 8 00:07:19 PDT 2018


kristof.beyls created this revision.
kristof.beyls added reviewers: JDevlieghere, lebedev.ri, philip.pfaffe.
Herald added a subscriber: llvm-commits.

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:

- --send-report-to: 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.


Repository:
  rL LLVM

https://reviews.llvm.org/D47930

Files:
  utils/Reviewing/find_interesting_reviews.py


Index: utils/Reviewing/find_interesting_reviews.py
===================================================================
--- utils/Reviewing/find_interesting_reviews.py
+++ utils/Reviewing/find_interesting_reviews.py
@@ -554,17 +554,17 @@
         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,6 +585,16 @@
         default=True,
         help='Do not update cached Phabricator objects')
     parser.add_argument(
+        '--send-report-to',
+        dest='send_report_to',
+        default="",
+        help="A comma separated list of 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',
         nargs='*',
         help="The email addresses (as known by LLVM git) of " +
@@ -609,7 +619,9 @@
         phab,
         days=1,
         filter_reviewers=filter_reviewers_to_report_for(people_to_look_for))
-    send_emails(people_to_look_for, msg)
+
+    if args.send_report_to != '':
+        send_emails(args.send_report_to.split(","), args.sender, msg)
 
 
 if __name__ == "__main__":


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47930.150452.patch
Type: text/x-patch
Size: 1963 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180608/3cf44ab8/attachment.bin>


More information about the llvm-commits mailing list