* add svn:executables
[lab.git] / TipAndDoc / tools / svn / hooks / post-commit
1 #!/bin/sh
2
3 # POST-COMMIT HOOK
4 #
5 # The post-commit hook is invoked after a commit.  Subversion runs
6 # this hook by invoking a program (script, executable, binary, etc.)
7 # named 'post-commit' (for which this file is a template) with the 
8 # following ordered arguments:
9 #
10 #   [1] REPOS-PATH   (the path to this repository)
11 #   [2] REV          (the number of the revision just committed)
12 #
13 # The default working directory for the invocation is undefined, so
14 # the program should set one explicitly if it cares.
15 #
16 # Because the commit 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 # newly-committed tree.
20 #
21 # On a Unix system, the normal procedure is to have 'post-commit'
22 # invoke other programs to do the real work, though it may do the
23 # work itself too.
24 #
25 # Note that 'post-commit' 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-commit.bat' or 'post-commit.exe',
31 # but the basic idea is the same.
32
33 # The hook program typically does not inherit the environment of
34 # its parent process.  For example, a common problem is for the
35 # PATH environment variable to not be set to its usual value, so
36 # that subprograms fail to launch unless invoked via absolute path.
37 # If you're having unexpected problems with a hook program, the
38 # culprit may be unusual (or missing) environment variables.
39
40 # Here is an example hook script, for a Unix /bin/sh interpreter.
41 # For more examples and pre-written hooks, see those in
42 # /usr/share/subversion/hook-scripts, and in the repository at
43 # http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
44 # http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
45
46
47 REPOS="$1"
48 REV="$2"
49
50 # "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
51
52 PROJECT_NAME=`basename $REPOS`
53 DIRNAME=`dirname $REPOS`
54 SUB_ROOTDIR=`basename $DIRNAME`
55
56 export PYTHON_EGG_CACHE="/tmp"
57 export TRAC_ENV="/var/trac/${SUB_ROOTDIR}/${PROJECT_NAME}"
58 /home/tools/trac/contrib/trac-svn-hook $REPOS $REV