| 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 | # [3] TXN-NAME (the name of the transaction that has become REV)
|
|---|
| 13 | #
|
|---|
| 14 | # Because the commit has already completed and cannot be undone,
|
|---|
| 15 | # the exit code of the hook program is ignored. The hook program
|
|---|
| 16 | # can use the 'svnlook' utility to help it examine the
|
|---|
| 17 | # newly-committed tree.
|
|---|
| 18 | #
|
|---|
| 19 | # The default working directory for the invocation is undefined, so
|
|---|
| 20 | # the program should set one explicitly if it cares.
|
|---|
| 21 | #
|
|---|
| 22 | # On a Unix system, the normal procedure is to have 'post-commit'
|
|---|
| 23 | # invoke other programs to do the real work, though it may do the
|
|---|
| 24 | # work itself too.
|
|---|
| 25 | #
|
|---|
| 26 | # Note that 'post-commit' must be executable by the user(s) who will
|
|---|
| 27 | # invoke it (typically the user httpd runs as), and that user must
|
|---|
| 28 | # have filesystem-level permission to access the repository.
|
|---|
| 29 | #
|
|---|
| 30 | # On a Windows system, you should name the hook program
|
|---|
| 31 | # 'post-commit.bat' or 'post-commit.exe',
|
|---|
| 32 | # but the basic idea is the same.
|
|---|
| 33 | #
|
|---|
| 34 | # The hook program runs in an empty environment, unless the server is
|
|---|
| 35 | # explicitly configured otherwise. For example, a common problem is for
|
|---|
| 36 | # the PATH environment variable to not be set to its usual value, so
|
|---|
| 37 | # that subprograms fail to launch unless invoked via absolute path.
|
|---|
| 38 | # If you're having unexpected problems with a hook program, the
|
|---|
| 39 | # culprit may be unusual (or missing) environment variables.
|
|---|
| 40 | #
|
|---|
| 41 | # CAUTION:
|
|---|
| 42 | # For security reasons, you MUST always properly quote arguments when
|
|---|
| 43 | # you use them, as those arguments could contain whitespace or other
|
|---|
| 44 | # problematic characters. Additionally, you should delimit the list
|
|---|
| 45 | # of options with "--" before passing the arguments, so malicious
|
|---|
| 46 | # clients cannot bootleg unexpected options to the commands your
|
|---|
| 47 | # script aims to execute.
|
|---|
| 48 | # For similar reasons, you should also add a trailing @ to URLs which
|
|---|
| 49 | # are passed to SVN commands accepting URLs with peg revisions.
|
|---|
| 50 | #
|
|---|
| 51 | # Here is an example hook script, for a Unix /bin/sh interpreter.
|
|---|
| 52 | # For more examples and pre-written hooks, see those in
|
|---|
| 53 | # the Subversion repository at
|
|---|
| 54 | # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
|
|---|
| 55 | # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 | REPOS="$1"
|
|---|
| 59 | REV="$2"
|
|---|
| 60 | TXN_NAME="$3"
|
|---|
| 61 |
|
|---|
| 62 | mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
|
|---|