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