#!/bin/sh

shift
TO=dev@mysql.com
FROM=$USER@mysql.com

if [ "$BK_COMMIT" = OK ]
then 
 echo "Commit successful, notifying developers at $TO"
 (
   cat <<EOF
From: $FROM
To: $TO
Subject: bk commit

EOF
  bk changes -v -r+
  bk cset -r+ -d
 ) | /usr/sbin/sendmail -t
else
 echo "commit failed because '$BK_COMMIT', sorry life is hard..." 
fi
