From: Geoffrey Thomas Date: Sun, 1 Feb 2009 15:45:08 +0000 (-0500) Subject: svn zephyr post commit hook X-Git-Url: https://sipb.mit.edu/gitweb.cgi/snippets/.git/commitdiff_plain/2bc10a4aa9bfb33a54e5fc3768ea652a16f8bb37?hp=5b11b497328f5168100a837b9f13c1f97f0074a7 svn zephyr post commit hook --- diff --git a/svn-hooks/commit-zephyr b/svn-hooks/commit-zephyr new file mode 100755 index 0000000..f23877a --- /dev/null +++ b/svn-hooks/commit-zephyr @@ -0,0 +1,41 @@ +#!/bin/bash + +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 "r$REV - $dirs"