svn:鉤子post-commit

1向2飛發表於2017-08-04
# 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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章