source: XMLIO_V2/tools/FCM/examples/svn-hooks/post-revprop-change @ 81

Last change on this file since 81 was 81, checked in by ymipsl, 12 years ago

ajout FCM 1.5

File size: 2.5 KB
Line 
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
49REPOS="$1"
50REV="$2"
51USER="$3"
52PROPNAME="$4"
53ACTION="$5"
54
55REPOS_NAME=${REPOS##*/}
56LOG_DIR=~fcm/svn/revprop-change
57LOG_FILE=$LOG_DIR/${REPOS_NAME}.post.log
58TRAC=${REPOS%/svn/live/*}/trac/live/${REPOS_NAME%_svn}
59CMD="trac-admin $TRAC resync $REV"
60
61echo "$(date): Updating log of revision $REV ..." >$LOG_FILE
62$CMD 1>>$LOG_FILE 2>&1
63RC=$?
64
65if ((RC != 0)); then
66  /bin/mail -s "$CMD failed" my.name@somewhere.org <<EOF
67$(<$LOG_FILE)
68EOF
69fi
70
71exit $RC
Note: See TracBrowser for help on using the repository browser.