| 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 changed. Subversion runs this hook by invoking a program |
|---|
| 7 | # (script, executable, binary, etc.) named 'post-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 that was tweaked) |
|---|
| 13 | # [3] USER (the username of the person tweaking the property) |
|---|
| 14 | # [4] PROPNAME (the property that was changed) |
|---|
| 15 | # |
|---|
| 16 | # Because the propchange has already completed and cannot be undone, |
|---|
| 17 | # the exit code of the hook program is ignored. The hook program |
|---|
| 18 | # can use the 'svnlook' utility to help it examine the |
|---|
| 19 | # new property value. |
|---|
| 20 | # |
|---|
| 21 | # On a Unix system, the normal procedure is to have 'post-revprop-change' |
|---|
| 22 | # invoke other programs to do the real work, though it may do the |
|---|
| 23 | # work itself too. |
|---|
| 24 | # |
|---|
| 25 | # Note that 'post-revprop-change' must be executable by the user(s) who will |
|---|
| 26 | # invoke it (typically the user httpd runs as), and that user must |
|---|
| 27 | # have filesystem-level permission to access the repository. |
|---|
| 28 | # |
|---|
| 29 | # On a Windows system, you should name the hook program |
|---|
| 30 | # 'post-revprop-change.bat' or 'post-revprop-change.exe', |
|---|
| 31 | # but the basic idea is the same. |
|---|
| 32 | # |
|---|
| 33 | # Here is an example hook script, for a Unix /bin/sh interpreter: |
|---|
| 34 | |
|---|
| 35 | REPOS="$1" |
|---|
| 36 | REV="$2" |
|---|
| 37 | USER="$3" |
|---|
| 38 | PROPNAME="$4" |
|---|
| 39 | |
|---|
| 40 | # ---- resync comment changes after pre-revprop-change |
|---|
| 41 | |
|---|
| 42 | LOG=/var/log/svn/pre-revprop-change |
|---|
| 43 | |
|---|
| 44 | # production Trac |
|---|
| 45 | TRAC_ENV=/path/to/your/trac/env |
|---|
| 46 | |
|---|
| 47 | # For testing, use: |
|---|
| 48 | # TRAC_ENV=... |
|---|
| 49 | |
|---|
| 50 | # Python settings |
|---|
| 51 | PYTHON_HOME=/opt/python-2.4.4 |
|---|
| 52 | |
|---|
| 53 | PATH=$PYTHON_HOME/bin:$PATH |
|---|
| 54 | export PATH |
|---|
| 55 | LD_LIBRARY_PATH=/opt/sqlite-3.3.8/lib:/opt/python-2.4.4/lib |
|---|
| 56 | export LD_LIBRARY_PATH |
|---|
| 57 | |
|---|
| 58 | # ---- |
|---|
| 59 | |
|---|
| 60 | if [ "$PROPNAME" = "svn:log" -o "$PROPNAME" = "svn:author" ] |
|---|
| 61 | then |
|---|
| 62 | trac-admin $TRAC_ENV resync $REV 2>> $LOG.err >> $LOG.log |
|---|
| 63 | fi |
|---|
| 64 | |
|---|
| 65 | |
|---|