[1578] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | # POST-REVPROP-CHANGE HOOK |
---|
| 4 | # |
---|
| 5 | # The post-revprop-change hook is invoked after a revision property |
---|
| 6 | # has been added, modified or deleted. Subversion runs this hook by |
---|
| 7 | # invoking a program (script, executable, binary, etc.) named |
---|
| 8 | # 'post-revprop-change' (for which this file is a template), with the |
---|
| 9 | # following ordered arguments: |
---|
| 10 | # |
---|
| 11 | # [1] REPOS-PATH (the path to this repository) |
---|
| 12 | # [2] REV (the revision that was tweaked) |
---|
| 13 | # [3] USER (the username of the person tweaking the property) |
---|
| 14 | # [4] PROPNAME (the property that was changed) |
---|
| 15 | # [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted) |
---|
| 16 | # |
---|
| 17 | # [STDIN] PROPVAL ** the old property value is passed via STDIN. |
---|
| 18 | # |
---|
| 19 | # Because the propchange has already completed and cannot be undone, |
---|
| 20 | # the exit code of the hook program is ignored. The hook program |
---|
| 21 | # can use the 'svnlook' utility to help it examine the |
---|
| 22 | # new property value. |
---|
| 23 | # |
---|
| 24 | # On a Unix system, the normal procedure is to have 'post-revprop-change' |
---|
| 25 | # invoke other programs to do the real work, though it may do the |
---|
| 26 | # work itself too. |
---|
| 27 | # |
---|
| 28 | # Note that 'post-revprop-change' must be executable by the user(s) who will |
---|
| 29 | # invoke it (typically the user httpd runs as), and that user must |
---|
| 30 | # have filesystem-level permission to access the repository. |
---|
| 31 | # |
---|
| 32 | # On a Windows system, you should name the hook program |
---|
| 33 | # 'post-revprop-change.bat' or 'post-revprop-change.exe', |
---|
| 34 | # but the basic idea is the same. |
---|
| 35 | # |
---|
| 36 | # The hook program typically does not inherit the environment of |
---|
| 37 | # its parent process. For example, a common problem is for the |
---|
| 38 | # PATH environment variable to not be set to its usual value, so |
---|
| 39 | # that subprograms fail to launch unless invoked via absolute path. |
---|
| 40 | # If you're having unexpected problems with a hook program, the |
---|
| 41 | # culprit may be unusual (or missing) environment variables. |
---|
| 42 | # |
---|
| 43 | # Here is an example hook script, for a Unix /bin/sh interpreter. |
---|
| 44 | # For more examples and pre-written hooks, see those in |
---|
| 45 | # the Subversion repository at |
---|
| 46 | # http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and |
---|
| 47 | # http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/ |
---|
| 48 | |
---|
| 49 | REPOS="$1" |
---|
| 50 | REV="$2" |
---|
| 51 | USER="$3" |
---|
| 52 | PROPNAME="$4" |
---|
| 53 | ACTION="$5" |
---|
| 54 | |
---|
| 55 | REPOS_NAME=${REPOS##*/} |
---|
| 56 | LOG_DIR=~fcm/svn/revprop-change |
---|
| 57 | LOG_FILE=$LOG_DIR/${REPOS_NAME}.post.log |
---|
| 58 | CMD=${REPOS}/hooks/post-revprop-change.py |
---|
| 59 | |
---|
| 60 | $CMD "$@" <&0 1>$LOG_FILE 2>&1 |
---|
| 61 | RC=$? |
---|
| 62 | |
---|
| 63 | if ((RC != 0)); then |
---|
| 64 | /bin/mail -s "$CMD failed" my.name@somewhere.org <<EOF |
---|
| 65 | $(<$LOG_FILE) |
---|
| 66 | EOF |
---|
| 67 | fi |
---|
| 68 | |
---|
| 69 | exit $RC |
---|