hipl-core team mailing list archive
-
hipl-core team
-
Mailing list archive
-
Message #00089
[Branch ~hipl-core/hipl/trunk] Rev 4917: Add the mailing script for commit notification.
------------------------------------------------------------
revno: 4917
committer: Mircea Gherzan <mircea.gherzan@xxxxxxxxxxxxxx>
branch nick: trunk
timestamp: Thu 2010-08-26 16:12:39 +0200
message:
Add the mailing script for commit notification.
added:
tools/mailer.sh
--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk
Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== added file 'tools/mailer.sh'
--- tools/mailer.sh 1970-01-01 00:00:00 +0000
+++ tools/mailer.sh 2010-08-26 14:12:39 +0000
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# Mailer script that notifies about commits to a BZR repo
+#
+# Copyright (c) 2010 Mircea Gherzan <mgherzan@xxxxxxxxx>
+
+# path to the BZR repository
+REPO=/home/$USER/src/hipl
+# path to the file containing the last processed revision
+LASTREV=/tmp/mailer_lastrev.txt
+# buffer used to build the body of the e-mail
+MAILBUF=/tmp/mailer_buffer.txt
+
+# mailing coordinates
+SENDTO=hipl-core@xxxxxxxxxxxxxxxxxxx
+REPLYTO=hipl-core@xxxxxxxxxxxxxxxxxxx
+
+#####################################################################
+
+if [ ! -e $LASTREV ] ; then
+ echo File with the last revno does not exist!
+ echo Please create $LASTREV
+ exit 1
+fi
+
+read lastrev < $LASTREV
+
+# from now on, working in the BZR repo
+cd $REPO
+
+# update the repo to get the last revision
+bzr up
+
+# get the HEAD revision (the last one)
+head=$(bzr revno)
+
+# lastrev was already processed, so incrementing it
+lastrev=$(($lastrev + 1))
+
+for rev in $(seq $lastrev $head) ; do
+
+ committer=$(bzr log -r $rev | head -3 | tail -1 | sed -e "s/committer: //g")
+
+ branch=$(bzr log -r $rev | head -4 | tail -1 | sed -e "s/branch nick: //g")
+
+ firstline=$(bzr log -r $rev | head -7 | tail -1 | sed -e "s/^ *//")
+
+ subject="[$branch] $rev: $firstline"
+
+ # create the body of the e-mail
+ > $MAILBUF
+ bzr log -r $rev | tail -n +7 >> $MAILBUF
+ echo "" >> $MAILBUF
+ bzr diff -c $rev >> $MAILBUF
+
+ # send the e-mail
+ mailx -s "$subject" -Sfrom="$committer" -Sreplyto=$REPLYTO $SENDTO < $MAILBUF
+done
+
+echo $head > $LASTREV
+
+exit 0
Follow ups