better URL to the web interface
[snippets/.git] / svn-hooks / commit-zephyr
1 #!/bin/bash
2
3 CLASS=test
4 INSTANCE=@
5 FULL=0
6
7 OPTS=$(getopt -o c:i:f -l class:,instance:,full -n "$0" -- "$@") || exit $?
8 eval set -- "$OPTS"
9 while :; do
10     case "$1" in
11         -c|--class) CLASS=$2; shift 2;;
12         -i|--instance) INSTANCE=$2; shift 2;;
13         -f|--full) FULL=1; shift;;
14         --) shift; break;;
15         *) exit 1;;
16     esac
17 done
18 [ $# -ge 2 ] || exit 1
19 REPOS=$1
20 REV=$2
21
22 if [ "$INSTANCE" = "${INSTANCE%@}@" ]; then
23     INSTANCE=${INSTANCE%@}r$REV
24 fi
25
26 dirs=$(svnlook dirs-changed "$REPOS" -r "$REV")
27 svnlook info "$REPOS" -r "$REV" | (
28     read -r author
29     read -r datestamp
30     read -r logsize
31     log=$(cat)
32     echo "r$REV by $author $datestamp"
33     echo "$log"
34     svnlook changed "$REPOS" -r "$REV"
35     if [ "$FULL" -eq 1 ]; then
36         echo
37         svnlook diff "$REPOS" -r "$REV"
38     else
39         echo svnlook diff "$REPOS" -r "$REV"
40     fi
41 ) | zwrite -d -c "$CLASS" -i "$INSTANCE" -O "auto" -s "r$REV - $dirs"