post-commit.tmpl 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh
  2. # POST-COMMIT HOOK
  3. #
  4. # The post-commit hook is invoked after a commit. Subversion runs
  5. # this hook by invoking a program (script, executable, binary, etc.)
  6. # named 'post-commit' (for which this file is a template) with the
  7. # following ordered arguments:
  8. #
  9. # [1] REPOS-PATH (the path to this repository)
  10. # [2] REV (the number of the revision just committed)
  11. # [3] TXN-NAME (the name of the transaction that has become REV)
  12. #
  13. # Because the commit has already completed and cannot be undone,
  14. # the exit code of the hook program is ignored. The hook program
  15. # can use the 'svnlook' utility to help it examine the
  16. # newly-committed tree.
  17. #
  18. # The default working directory for the invocation is undefined, so
  19. # the program should set one explicitly if it cares.
  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 runs in an empty environment, unless the server is
  34. # explicitly configured otherwise. For example, a common problem is for
  35. # the 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. # CAUTION:
  41. # For security reasons, you MUST always properly quote arguments when
  42. # you use them, as those arguments could contain whitespace or other
  43. # problematic characters. Additionally, you should delimit the list
  44. # of options with "--" before passing the arguments, so malicious
  45. # clients cannot bootleg unexpected options to the commands your
  46. # script aims to execute.
  47. # For similar reasons, you should also add a trailing @ to URLs which
  48. # are passed to SVN commands accepting URLs with peg revisions.
  49. #
  50. # Here is an example hook script, for a Unix /bin/sh interpreter.
  51. # For more examples and pre-written hooks, see those in
  52. # the Subversion repository at
  53. # http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
  54. # http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
  55. REPOS="$1"
  56. REV="$2"
  57. TXN_NAME="$3"
  58. mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf