9e284a917d099a31d807f21fdcd0f09425cd9b55
[hooke.git] / hooks / pre-revprop-change.tmpl
1 #!/bin/sh\r
2 \r
3 # PRE-REVPROP-CHANGE HOOK\r
4 #\r
5 # The pre-revprop-change hook is invoked before a revision property\r
6 # is added, modified or deleted.  Subversion runs this hook by invoking\r
7 # a program (script, executable, binary, etc.) named 'pre-revprop-change'\r
8 # (for which this file is a template), with the following ordered\r
9 # arguments:\r
10 #\r
11 #   [1] REPOS-PATH   (the path to this repository)\r
12 #   [2] REVISION     (the revision being tweaked)\r
13 #   [3] USER         (the username of the person tweaking the property)\r
14 #   [4] PROPNAME     (the property being set on the revision)\r
15 #   [5] ACTION       (the property is being 'A'dded, 'M'odified, or 'D'eleted)\r
16 #\r
17 #   [STDIN] PROPVAL  ** the new property value is passed via STDIN.\r
18 #\r
19 # If the hook program exits with success, the propchange happens; but\r
20 # if it exits with failure (non-zero), the propchange doesn't happen.\r
21 # The hook program can use the 'svnlook' utility to examine the \r
22 # existing value of the revision property.\r
23 #\r
24 # WARNING: unlike other hooks, this hook MUST exist for revision\r
25 # properties to be changed.  If the hook does not exist, Subversion \r
26 # will behave as if the hook were present, but failed.  The reason\r
27 # for this is that revision properties are UNVERSIONED, meaning that\r
28 # a successful propchange is destructive;  the old value is gone\r
29 # forever.  We recommend the hook back up the old value somewhere.\r
30 #\r
31 # On a Unix system, the normal procedure is to have 'pre-revprop-change'\r
32 # invoke other programs to do the real work, though it may do the\r
33 # work itself too.\r
34 #\r
35 # Note that 'pre-revprop-change' must be executable by the user(s) who will\r
36 # invoke it (typically the user httpd runs as), and that user must\r
37 # have filesystem-level permission to access the repository.\r
38 #\r
39 # On a Windows system, you should name the hook program\r
40 # 'pre-revprop-change.bat' or 'pre-revprop-change.exe',\r
41 # but the basic idea is the same.\r
42 #\r
43 # The hook program typically does not inherit the environment of\r
44 # its parent process.  For example, a common problem is for the\r
45 # PATH environment variable to not be set to its usual value, so\r
46 # that subprograms fail to launch unless invoked via absolute path.\r
47 # If you're having unexpected problems with a hook program, the\r
48 # culprit may be unusual (or missing) environment variables.\r
49\r
50 # Here is an example hook script, for a Unix /bin/sh interpreter.\r
51 # For more examples and pre-written hooks, see those in\r
52 # the Subversion repository at\r
53 # http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and\r
54 # http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/\r
55 \r
56 \r
57 REPOS="$1"\r
58 REV="$2"\r
59 USER="$3"\r
60 PROPNAME="$4"\r
61 ACTION="$5"\r
62 \r
63 if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi\r
64 \r
65 echo "Changing revision properties other than svn:log is prohibited" >&2\r
66 exit 1\r