#!/bin/bash # # This is a script that can be called from a Subversion post-commit hook # to zephyr a summary of the commit or the full commit. # # Use by putting something like the following in hooks/post-commit: # REPOS="$1" # REV="$2" # /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" -c scripts # /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" --full -c scripts-auto -i commits export LC_ALL=en_US.UTF-8 CLASS=test INSTANCE=@ FULL=0 OPTS=$(getopt -o c:i:f -l class:,instance:,full -n "$0" -- "$@") || exit $? eval set -- "$OPTS" while :; do case "$1" in -c|--class) CLASS=$2; shift 2;; -i|--instance) INSTANCE=$2; shift 2;; -f|--full) FULL=1; shift;; --) shift; break;; *) exit 1;; esac done [ $# -ge 2 ] || exit 1 REPOS=$1 REV=$2 if [ "$INSTANCE" = "${INSTANCE%@}@" ]; then INSTANCE=${INSTANCE%@}r$REV fi dirs=$(svnlook dirs-changed "$REPOS" -r "$REV") svnlook info "$REPOS" -r "$REV" | ( read -r author read -r datestamp read -r logsize log=$(cat) echo "r$REV by $author $datestamp" echo "$log" svnlook changed "$REPOS" -r "$REV" if [ "$FULL" -eq 1 ]; then echo svnlook diff "$REPOS" -r "$REV" else echo svnlook diff "$REPOS" -r "$REV" fi ) | zwrite -d -c "$CLASS" -i "$INSTANCE" -O "auto" -s "SVN: r$REV"