Oct 25, 2008

Subversion の一日分の更新状況をメール通知する

Subversion の一日分の更新情報をメールで送信するシェルスクリプトを載せておく。

#!/bin/sh

REPOS="/my/svn/repos"
TMPFILE="./todayscommit.tmp"
DATE=`date +"%Y-%m-%d"`
DATE2=`date +"%Y/%m/%d"`
SVNLOOK="/usr/bin/svnlook"
YOUNGEST=`$SVNLOOK youngest "$REPOS"`
MAILADDRESS="me@example.com"
MAILSUBJECT="Today's COMMIT $REPOS ($DATE2)"

echo "Today's commit : $DATE2" > $TMPFILE
echo "" >> $TMPFILE

i=$YOUNGEST
while [ $i -ge 0 ];
do
  REVDATE=`$SVNLOOK date -r $i $REPOS | sed -e "s/[[:blank:]].*//g"`
  if [ $REVDATE = $DATE ];
  then
    echo "***** Revision $i ***************************************" >> $TMPFILE
    $SVNLOOK info -r $i $REPOS >> $TMPFILE
  else
    break 1 
  fi
  i=`expr $i - 1`
done

mail -s "$MAILSUBJECT" "$MAILADDRESS" < $TMPFILE

rm $TMPFILE

TrackBack ping me at
http://www.in-vitro.jp/blog/index.cgi/Subversion/20081025_01.trackback
Post a comment

writeback message: Ready to post a comment.