ITPub博客

首页 > Linux操作系统 > Linux操作系统 > svn:钩子post-commit

svn:钩子post-commit

原创 Linux操作系统 作者:1向2飞 时间:2017-08-04 14:29:51 0 删除 编辑
# The post-commit hook is invoked(调用) after a commit.  Subversion runs
# this hook by invoking a program (script, executable, binary, etc.)
# named 'post-commit' (for which this file is a template) with(使用) the 
# following ordered(命令) arguments:
#
#   [1] REPOS-PATH   (the path to this repository)
#   [2] REV          (the number of the revision(版本) just committed)
#
# The default working directory for the invocation(调用) is undefined, so
# the program should set one explicitly(明确的) if it cares(真的在乎).
#
# Because the commit has already completed and cannot be undone,
# the exit(退出) code of the hook program is ignored.  The hook program
# can use the 'svnlook' utility(工具) to help it examine the
# newly-committed tree.
#
# On a Unix system, the normal procedure is to have 'post-commit'
# invoke other programs to do the real work, though it may do the
# work itself too.
#
# Note that 'post-commit' must be executable(可执行) by the user(s) who will
# invoke it (typically the user httpd runs as), and that user must
# have filesystem-level permission to access the repository.
#
# On a Windows system, you should name the hook program
# 'post-commit.bat' or 'post-commit.exe',
# but the basic idea is the same.

# The hook program typically(一般) does not inherit(继承) the environment of
# its parent process.  For example, a common problem is for the
# PATH environment variable to not be set to its usual value, so
# that subprograms fail to launch(启用) unless invoked via absolute(绝对) path.
# If you're having unexpected problems with a hook program, the
# culprit(罪魁祸首) may be unusual(异常) (or missing) environment variables.

# Here is an example hook script, for a Unix /bin/sh interpreter(解释).
# For more examples and pre-written hooks, see those in
# the Subversion repository at
# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/




REPOS="$1"
REV="$2"


mailer.py commit "$REPOS" "$REV" /path/to/mailer.conf
总结:
1、post-commit的作用
The post-commit hook is invoked after a commit.
2、参数
#   [1] REPOS-PATH   (the path to this repository)
#   [2] REV          (the number of the revision just committed)
3、svnlook
4、使用的user对post-commit可执行权限和对要操作的库有access权限。
5、windows下重命名为'post-commit.bat' or 'post-commit.exe'。
6、子程序不能继承父程序的环境变量。

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23890223/viewspace-2143094/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-05-11

  • 博文量
    73
  • 访问量
    332801