I've been looking for a collection of example post-commit hook scripts without much luck. If anyone knows of a good one, can you please point me in the right direction? If I can avoid reinventing some wheels, that would be great.

In particular, at the moment I'm looking for a post-commit hook that will email *only* the user who made the previous commit.

Thanks everyone for your suggestions and input. In case it may help someone in the future, here's a very simple post-commit bash script to send email to the person who had committed the previous revision:

-------------------------------

#!/bin/bash

REPOS="$1"
REV="$2"

ADDRFILE="${REPOS}/conf/addresses"
  # format assumed to be "username n...@someplace.com"

# find the number of the previous revision
PREVREV=`expr $REV - 1`

# find the author of the previous revision
PREVAUTHOR=`/usr/bin/svnlook author $REPOS -r $PREVREV`

# find previous author's email address
PREVADDR=`grep ^"${PREVAUTHOR} " $ADDRFILE | awk '{print $2}'`

# find files changed in current commit
CHANGED=`/usr/bin/svnlook changed $REPOS -r $REV`

# get project name
PROJ=`echo $REPOS | awk -F/ '{print $NF}'`

# mail this info to previous committer
echo "$CHANGED" | /bin/mail -s "new commit to $PROJ repository" $PREVADDR
-----------------------------

Reply via email to