review: Send a humbug along with review requests.

I think it might be nice to have it also specify some information
about the new review request, but I think we benefit a lot from
getting this minimal version out the door.

(imported from commit cb04c72ee125763cff2d83a6afad3f5319d8ebc6)
This commit is contained in:
Tim Abbott
2012-11-05 13:31:10 -05:00
parent a9da4d2a72
commit 5e92cabb96

View File

@@ -298,6 +298,20 @@ def main(args):
print >>sys.stdout
print >>sys.stdout, msg.get_payload(decode=True),
else:
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
import api.common
me = get_current_user(repo)
api_key_file = os.path.join(os.environ["HOME"], '.humbug-api-key')
if not os.path.exists(api_key_file):
print >>sys.stderr, "You need to place your Humbug API key at %s" % (api_key_file,)
sys.exit(1)
client = api.common.HumbugAPI(email=me[me.index("<") + 1:me.index('>')],
api_key=file(api_key_file).read().strip(),
verbose=True)
client.send_message({'type': "personal",
'recipient': ", ".join(opts.reviewers),
'content': "I just sent you a review request! Check your email for details."})
if os.environ.get('REVIEW_USE_SENDMAIL', ''):
command = ['/usr/sbin/sendmail', '-bm', '-t']
else: