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