]> snippets.scripts.mit.edu Git - Scripts/git/.git/blame - svn-hooks/commit-zephyr
svn-hooks: Add a zephyr revprop hook and comment commit-zephyr a bit.
[Scripts/git/.git] / svn-hooks / commit-zephyr
CommitLineData
2bc10a4a 1#!/bin/bash
b4a486e4
GT
2#
3# This is a script that can be called from a Subversion post-commit hook
4# to zephyr a summary of the commit or the full commit.
5#
6# Use by putting something like the following in hooks/post-commit:
7# REPOS="$1"
8# REV="$2"
9# /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" -c scripts
10# /mit/snippets/svn-hooks/commit-zephyr "$REPOS" "$REV" --full -c scripts-auto -i commits
2bc10a4a
GT
11
12CLASS=test
13INSTANCE=@
14FULL=0
15
16OPTS=$(getopt -o c:i:f -l class:,instance:,full -n "$0" -- "$@") || exit $?
17eval set -- "$OPTS"
18while :; do
19 case "$1" in
20 -c|--class) CLASS=$2; shift 2;;
21 -i|--instance) INSTANCE=$2; shift 2;;
22 -f|--full) FULL=1; shift;;
23 --) shift; break;;
24 *) exit 1;;
25 esac
26done
27[ $# -ge 2 ] || exit 1
28REPOS=$1
29REV=$2
30
31if [ "$INSTANCE" = "${INSTANCE%@}@" ]; then
32 INSTANCE=${INSTANCE%@}r$REV
33fi
34
35dirs=$(svnlook dirs-changed "$REPOS" -r "$REV")
36svnlook info "$REPOS" -r "$REV" | (
37 read -r author
38 read -r datestamp
39 read -r logsize
40 log=$(cat)
41 echo "r$REV by $author $datestamp"
42 echo "$log"
43 svnlook changed "$REPOS" -r "$REV"
44 if [ "$FULL" -eq 1 ]; then
45 echo
46 svnlook diff "$REPOS" -r "$REV"
47 else
48 echo svnlook diff "$REPOS" -r "$REV"
49 fi
f208ccb4 50) | zwrite -d -c "$CLASS" -i "$INSTANCE" -O "auto" -s "SVN: r$REV"