llvm.org GIT mirror llvm / 4d942d9
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@335948 91177308-0d34-0410-b5e6-96231b3b80d8 Kristof Beyls 1 year, 3 months ago
1 changed file(s) with 23 addition(s) and 6 deletion(s). Raw diff Collapse all Expand all
553553 output = get_git_cmd_output(cmd)
554554
555555
556 def send_emails(email_addresses, msg):
556 def send_emails(email_addresses, sender, msg):
557557 s = smtplib.SMTP()
558558 s.connect()
559559 for email_address in email_addresses:
560560 email_msg = email.mime.multipart.MIMEMultipart()
561 email_msg['From'] = ''
561 email_msg['From'] = sender
562562 email_msg['To'] = email_address
563563 email_msg['Subject'] = 'LLVM patches you may be able to review.'
564 email_msg.attach(email.mime.text.MIMEText(msg, 'plain'))
564 email_msg.attach(email.mime.text.MIMEText(msg.encode('utf-8'), 'plain'))
565565 # python 3.x: s.send_message(email_msg)
566 s.sendmail(email_msg['From'], email_msg['To'], msg)
566 s.sendmail(email_msg['From'], email_msg['To'], email_msg.as_string())
567567 s.quit()
568568
569569
584584 default=True,
585585 help='Do not update cached Phabricator objects')
586586 parser.add_argument(
587 'email_addresses',
587 '--email-report',
588 dest='email_report',
589 nargs='*',
590 default="",
591 help="A email addresses to send the report to.")
592 parser.add_argument(
593 '--sender',
594 dest='sender',
595 default="",
596 help="The email address to use in 'From' on messages emailed out.")
597 parser.add_argument(
598 '--email-addresses',
599 dest='email_addresses',
588600 nargs='*',
589601 help="The email addresses (as known by LLVM git) of " +
590602 "the people to look for reviews for.")
596608 logging.basicConfig(level=logging.DEBUG)
597609
598610 people_to_look_for = [e.decode('utf-8') for e in args.email_addresses]
611 logging.debug("Will look for reviews that following contributors could " +
612 "review: {}".format(people_to_look_for))
613 logging.debug("Will email a report to: {}".format(args.email_report))
599614
600615 phab = init_phab_connection()
601616
608623 phab,
609624 days=1,
610625 filter_reviewers=filter_reviewers_to_report_for(people_to_look_for))
611 send_emails(people_to_look_for, msg)
626
627 if args.email_report != []:
628 send_emails(args.email_report, args.sender, msg)
612629
613630
614631 if __name__ == "__main__":