Reputation: 13
I have a working Subversion Post Commit working OK - how do I add in the comments made by the user performing the commit?
My code is
REPOS="$1"
REV="$2"
AUTHOR="$(svnlook author -r $REV $REPOS)"
mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
# Script to send simple email when SVN is updated
# email subject
SUBJECT="[Project Name goes here] - new commit made in Subversion"
# Email To
EMAIL="[email addresses go here]"
# Date and time
DATE="$(date)"
# Email text/message
EMAILMESSAGE="/tmp/buildingcontrolmessage.txt"
echo "The commit happened: " $DATE > $EMAILMESSAGE
echo "Repository: " $1 >> $EMAILMESSAGE
echo "Reveision: " $2 >> $EMAILMESSAGE
echo "The commit was made by: $AUTHOR" >> $EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
I'd just like to add a line in the e-mail to say:
echo "Comment: $MSG" >> $EMAILMESSAGE
But I'm not sure how to get the message from the commit.
Thanks for any help and advice.
Upvotes: 0
Views: 2481
Reputation: 13
Just in case other people want to do the same - here's what I did in the end:
REPOS="$1"
REV="$2"
AUTHOR="$(svnlook author -r $REV $REPOS)"
MESSAGE="$(svnlook log $REPOS)"
mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
# Script to send simple email when SVN is updated
# email subject
SUBJECT="New commit made in Subversion"
# Email To ?
EMAIL="[email address or addresses]"
# Date and time
DATE="$(date)"
# Email text/message
EMAILMESSAGE="/tmp/emailmessagemessage.txt"
echo "The commit happened: " $DATE > $EMAILMESSAGE
echo "Repository: " $1 >> $EMAILMESSAGE
echo "Reveision: " $2 >> $EMAILMESSAGE
echo "The commit was made by: $AUTHOR" >> $EMAILMESSAGE
echo "Comment: $MESSAGE" >> $EMAILMESSAGE
# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
Upvotes: 1
Reputation: 263
You have to parse the commit message from the output of svnlook info. Documentation:
Print the author, datestamp, log message size (in bytes), and log message, followed by a newline character.
Upvotes: 0