Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2227 | - | 1 | #!/bin/sh |
2 | |||
3 | # PRE-REVPROP-CHANGE HOOK |
||
4 | # |
||
5 | # The pre-revprop-change hook is invoked before a revision property |
||
6 | # is added, modified or deleted. Subversion runs this hook by invoking |
||
7 | # a program (script, executable, binary, etc.) named 'pre-revprop-change' |
||
8 | # (for which this file is a template), with the following ordered |
||
9 | # arguments: |
||
10 | # |
||
11 | # [1] REPOS-PATH (the path to this repository) |
||
12 | # [2] REV (the revision being tweaked) |
||
13 | # [3] USER (the username of the person tweaking the property) |
||
14 | # [4] PROPNAME (the property being set on the revision) |
||
15 | # [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted) |
||
16 | # |
||
17 | # [STDIN] PROPVAL ** the new property value is passed via STDIN. |
||
18 | # |
||
19 | # If the hook program exits with success, the propchange happens; but |
||
20 | # if it exits with failure (non-zero), the propchange doesn't happen. |
||
21 | # The hook program can use the 'svnlook' utility to examine the |
||
22 | # existing value of the revision property. |
||
23 | # |
||
24 | # WARNING: unlike other hooks, this hook MUST exist for revision |
||
25 | # properties to be changed. If the hook does not exist, Subversion |
||
26 | # will behave as if the hook were present, but failed. The reason |
||
27 | # for this is that revision properties are UNVERSIONED, meaning that |
||
28 | # a successful propchange is destructive; the old value is gone |
||
29 | # forever. We recommend the hook back up the old value somewhere. |
||
30 | # |
||
31 | # The default working directory for the invocation is undefined, so |
||
32 | # the program should set one explicitly if it cares. |
||
33 | # |
||
34 | # On a Unix system, the normal procedure is to have 'pre-revprop-change' |
||
35 | # invoke other programs to do the real work, though it may do the |
||
36 | # work itself too. |
||
37 | # |
||
38 | # Note that 'pre-revprop-change' must be executable by the user(s) who will |
||
39 | # invoke it (typically the user httpd runs as), and that user must |
||
40 | # have filesystem-level permission to access the repository. |
||
41 | # |
||
42 | # On a Windows system, you should name the hook program |
||
43 | # 'pre-revprop-change.bat' or 'pre-revprop-change.exe', |
||
44 | # but the basic idea is the same. |
||
45 | # |
||
46 | # The hook program runs in an empty environment, unless the server is |
||
47 | # explicitly configured otherwise. For example, a common problem is for |
||
48 | # the PATH environment variable to not be set to its usual value, so |
||
49 | # that subprograms fail to launch unless invoked via absolute path. |
||
50 | # If you're having unexpected problems with a hook program, the |
||
51 | # culprit may be unusual (or missing) environment variables. |
||
52 | # |
||
53 | # CAUTION: |
||
54 | # For security reasons, you MUST always properly quote arguments when |
||
55 | # you use them, as those arguments could contain whitespace or other |
||
56 | # problematic characters. Additionally, you should delimit the list |
||
57 | # of options with "--" before passing the arguments, so malicious |
||
58 | # clients cannot bootleg unexpected options to the commands your |
||
59 | # script aims to execute. |
||
60 | # For similar reasons, you should also add a trailing @ to URLs which |
||
61 | # are passed to SVN commands accepting URLs with peg revisions. |
||
62 | # |
||
63 | # Here is an example hook script, for a Unix /bin/sh interpreter. |
||
64 | # For more examples and pre-written hooks, see those in |
||
65 | # the Subversion repository at |
||
66 | # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and |
||
67 | # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/ |
||
68 | |||
69 | |||
70 | REPOS="$1" |
||
71 | REV="$2" |
||
72 | USER="$3" |
||
73 | PROPNAME="$4" |
||
74 | ACTION="$5" |
||
75 | |||
76 | if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi |
||
77 | |||
78 | echo "Changing revision properties other than svn:log is prohibited" >&2 |
||
79 | exit 1 |