]>
Commit | Line | Data |
---|---|---|
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 | 11 | |
3d8ed419 AK |
12 | export LC_ALL=en_US.UTF-8 |
13 | ||
2bc10a4a GT |
14 | CLASS=test |
15 | INSTANCE=@ | |
16 | FULL=0 | |
17 | ||
18 | OPTS=$(getopt -o c:i:f -l class:,instance:,full -n "$0" -- "$@") || exit $? | |
19 | eval set -- "$OPTS" | |
20 | while :; do | |
21 | case "$1" in | |
22 | -c|--class) CLASS=$2; shift 2;; | |
23 | -i|--instance) INSTANCE=$2; shift 2;; | |
24 | -f|--full) FULL=1; shift;; | |
25 | --) shift; break;; | |
26 | *) exit 1;; | |
27 | esac | |
28 | done | |
29 | [ $# -ge 2 ] || exit 1 | |
30 | REPOS=$1 | |
31 | REV=$2 | |
32 | ||
33 | if [ "$INSTANCE" = "${INSTANCE%@}@" ]; then | |
34 | INSTANCE=${INSTANCE%@}r$REV | |
35 | fi | |
36 | ||
37 | dirs=$(svnlook dirs-changed "$REPOS" -r "$REV") | |
38 | svnlook info "$REPOS" -r "$REV" | ( | |
39 | read -r author | |
40 | read -r datestamp | |
41 | read -r logsize | |
42 | log=$(cat) | |
43 | echo "r$REV by $author $datestamp" | |
44 | echo "$log" | |
45 | svnlook changed "$REPOS" -r "$REV" | |
46 | if [ "$FULL" -eq 1 ]; then | |
47 | echo | |
48 | svnlook diff "$REPOS" -r "$REV" | |
49 | else | |
50 | echo svnlook diff "$REPOS" -r "$REV" | |
51 | fi | |
f208ccb4 | 52 | ) | zwrite -d -c "$CLASS" -i "$INSTANCE" -O "auto" -s "SVN: r$REV" |