svn zephyr post commit hook
authorGeoffrey Thomas <geofft@mit.edu>
Sun, 1 Feb 2009 15:45:08 +0000 (10:45 -0500)
committerGeoffrey Thomas <geofft@mit.edu>
Sun, 1 Feb 2009 15:45:08 +0000 (10:45 -0500)
svn-hooks/commit-zephyr [new file with mode: 0755]

diff --git a/svn-hooks/commit-zephyr b/svn-hooks/commit-zephyr
new file mode 100755 (executable)
index 0000000..f23877a
--- /dev/null
@@ -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"