]>
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 GT |
11 | |
12 | CLASS=test | |
13 | INSTANCE=@ | |
14 | FULL=0 | |
15 | ||
16 | OPTS=$(getopt -o c:i:f -l class:,instance:,full -n "$0" -- "$@") || exit $? | |
17 | eval set -- "$OPTS" | |
18 | while :; 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 | |
26 | done | |
27 | [ $# -ge 2 ] || exit 1 | |
28 | REPOS=$1 | |
29 | REV=$2 | |
30 | ||
31 | if [ "$INSTANCE" = "${INSTANCE%@}@" ]; then | |
32 | INSTANCE=${INSTANCE%@}r$REV | |
33 | fi | |
34 | ||
35 | dirs=$(svnlook dirs-changed "$REPOS" -r "$REV") | |
36 | svnlook 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" |