📄 repos.c
字号:
APR_EOL_STR "#" APR_EOL_STR "# The default working directory for the invocation is undefined, so" APR_EOL_STR "# the program should set one explicitly if it cares." APR_EOL_STR "#" APR_EOL_STR "# If the hook program exits with success, the lock is destroyed; but" APR_EOL_STR "# if it exits with failure (non-zero), the unlock action is aborted" APR_EOL_STR "# and STDERR is returned to the client." APR_EOL_STR APR_EOL_STR "# On a Unix system, the normal procedure is to have " "'" SVN_REPOS__HOOK_PRE_UNLOCK "'" APR_EOL_STR "# invoke other programs to do the real work, though it may do the" APR_EOL_STR "# work itself too." APR_EOL_STR "#" APR_EOL_STR "# Note that" " '" SVN_REPOS__HOOK_PRE_UNLOCK "' " "must be executable by the user(s) who will" APR_EOL_STR "# invoke it (typically the user httpd runs as), and that user must" APR_EOL_STR "# have filesystem-level permission to access the repository." APR_EOL_STR "#" APR_EOL_STR "# On a Windows system, you should name the hook program" APR_EOL_STR "# '" SVN_REPOS__HOOK_PRE_UNLOCK ".bat' or " "'" SVN_REPOS__HOOK_PRE_UNLOCK ".exe'," APR_EOL_STR "# but the basic idea is the same." APR_EOL_STR "#" APR_EOL_STR "# Here is an example hook script, for a Unix /bin/sh interpreter:" APR_EOL_STR APR_EOL_STR "REPOS=\"$1\"" APR_EOL_STR "PATH=\"$2\"" APR_EOL_STR "USER=\"$3\"" APR_EOL_STR APR_EOL_STR "# If a lock is owned by a different person, don't allow it be broken." APR_EOL_STR "# (Maybe this script could send email to the lock owner?)" APR_EOL_STR APR_EOL_STR "SVNLOOK=" SVN_BINDIR "/svnlook" APR_EOL_STR "GREP=/bin/grep" APR_EOL_STR "SED=/bin/sed" APR_EOL_STR APR_EOL_STR "LOCK_OWNER=`$SVNLOOK lock \"$REPOS\" \"$PATH\" | \\" APR_EOL_STR " $GREP '^Owner: ' | $SED 's/Owner: //'`" APR_EOL_STR APR_EOL_STR "# If we get no result from svnlook, there's no lock, return success:" APR_EOL_STR "if [ \"$LOCK_OWNER\" = \"\" ]; then" APR_EOL_STR " exit 0" APR_EOL_STR "fi" APR_EOL_STR "# If the person unlocking matches the lock's owner, return success:" APR_EOL_STR "if [ \"$LOCK_OWNER\" = \"$USER\" ]; then" APR_EOL_STR " exit 0" APR_EOL_STR "fi" APR_EOL_STR APR_EOL_STR "# Otherwise, we've got an owner mismatch, so return failure:" APR_EOL_STR "echo \"Error: $PATH locked by ${LOCK_OWNER}.\" 1>&2" APR_EOL_STR "exit 1" APR_EOL_STR; SVN_ERR_W(svn_io_file_create(this_path, contents, pool), "Creating pre-unlock hook"); } /* end pre-unlock hook */ /* Post-commit hook. */ { this_path = apr_psprintf(pool, "%s%s", svn_repos_post_commit_hook(repos, pool), SVN_REPOS__HOOK_DESC_EXT); contents = "#!/bin/sh" APR_EOL_STR APR_EOL_STR "# POST-COMMIT HOOK" APR_EOL_STR "#" APR_EOL_STR "# The post-commit hook is invoked after a commit. Subversion runs" APR_EOL_STR "# this hook by invoking a program (script, executable, binary, etc.)" APR_EOL_STR "# named '" SVN_REPOS__HOOK_POST_COMMIT "' (for which this file is a template) with the " APR_EOL_STR "# following ordered arguments:" APR_EOL_STR "#" APR_EOL_STR "# [1] REPOS-PATH (the path to this repository)" APR_EOL_STR "# [2] REV (the number of the revision just committed)" APR_EOL_STR "#" APR_EOL_STR "# The default working directory for the invocation is undefined, so" APR_EOL_STR "# the program should set one explicitly if it cares." APR_EOL_STR "#" APR_EOL_STR "# Because the commit has already completed and cannot be undone," APR_EOL_STR "# the exit code of the hook program is ignored. The hook program" APR_EOL_STR "# can use the 'svnlook' utility to help it examine the" APR_EOL_STR "# newly-committed tree." APR_EOL_STR "#" APR_EOL_STR "# On a Unix system, the normal procedure is to have " "'" SVN_REPOS__HOOK_POST_COMMIT "'" APR_EOL_STR "# invoke other programs to do the real work, though it may do the" APR_EOL_STR "# work itself too." APR_EOL_STR "#" APR_EOL_STR "# Note that" " '" SVN_REPOS__HOOK_POST_COMMIT "' " "must be executable by the user(s) who will" APR_EOL_STR "# invoke it (typically the user httpd runs as), and that user must" APR_EOL_STR "# have filesystem-level permission to access the repository." APR_EOL_STR "#" APR_EOL_STR "# On a Windows system, you should name the hook program" APR_EOL_STR "# '" SVN_REPOS__HOOK_POST_COMMIT ".bat' or " "'" SVN_REPOS__HOOK_POST_COMMIT ".exe'," APR_EOL_STR "# but the basic idea is the same." APR_EOL_STR "# " APR_EOL_STR HOOKS_ENVIRONMENT_TEXT "# " APR_EOL_STR "# Here is an example hook script, for a Unix /bin/sh interpreter." APR_EOL_STR PREWRITTEN_HOOKS_TEXT APR_EOL_STR APR_EOL_STR "REPOS=\"$1\"" APR_EOL_STR "REV=\"$2\"" APR_EOL_STR APR_EOL_STR "commit-email.pl \"$REPOS\" \"$REV\" commit-watchers@example.org" APR_EOL_STR "log-commit.py --repository \"$REPOS\" --revision \"$REV\"" APR_EOL_STR; SVN_ERR_W(svn_io_file_create(this_path, contents, pool), _("Creating post-commit hook")); } /* end post-commit hook */ /* Post-lock hook. */ { this_path = apr_psprintf(pool, "%s%s", svn_repos_post_lock_hook(repos, pool), SVN_REPOS__HOOK_DESC_EXT); contents = "#!/bin/sh" APR_EOL_STR APR_EOL_STR "# POST-LOCK HOOK" APR_EOL_STR "#" APR_EOL_STR "# The post-lock hook is run after a path is locked. Subversion runs" APR_EOL_STR "# this hook by invoking a program (script, executable, binary, etc.)" APR_EOL_STR "# named '" SVN_REPOS__HOOK_POST_LOCK "' (for which this file is a template) with the " APR_EOL_STR "# following ordered arguments:" APR_EOL_STR "#" APR_EOL_STR "# [1] REPOS-PATH (the path to this repository)" APR_EOL_STR "# [2] USER (the user who created the lock)" APR_EOL_STR "#" APR_EOL_STR "# The paths that were just locked are passed to the hook via STDIN (as" APR_EOL_STR "# of Subversion 1.2, only one path is passed per invocation, but the" APR_EOL_STR "# plan is to pass all locked paths at once, so the hook program" APR_EOL_STR "# should be written accordingly)." APR_EOL_STR "#" APR_EOL_STR "# The default working directory for the invocation is undefined, so" APR_EOL_STR "# the program should set one explicitly if it cares." APR_EOL_STR "#" APR_EOL_STR "# Because the lock has already been created and cannot be undone," APR_EOL_STR "# the exit code of the hook program is ignored. The hook program" APR_EOL_STR "# can use the 'svnlook' utility to help it examine the" APR_EOL_STR "# newly-created lock." APR_EOL_STR "#" APR_EOL_STR "# On a Unix system, the normal procedure is to have " "'" SVN_REPOS__HOOK_POST_LOCK "'" APR_EOL_STR "# invoke other programs to do the real work, though it may do the" APR_EOL_STR "# work itself too." APR_EOL_STR "#" APR_EOL_STR "# Note that" " '" SVN_REPOS__HOOK_POST_LOCK "' " "must be executable by the user(s) who will" APR_EOL_STR "# invoke it (typically the user httpd runs as), and that user must" APR_EOL_STR "# have filesystem-level permission to access the repository." APR_EOL_STR "#" APR_EOL_STR "# On a Windows system, you should name the hook program" APR_EOL_STR "# '" SVN_REPOS__HOOK_POST_LOCK ".bat' or " "'" SVN_REPOS__HOOK_POST_LOCK ".exe'," APR_EOL_STR "# but the basic idea is the same." APR_EOL_STR "# " APR_EOL_STR "# Here is an example hook script, for a Unix /bin/sh interpreter:" APR_EOL_STR APR_EOL_STR "REPOS=\"$1\"" APR_EOL_STR "USER=\"$2\"" APR_EOL_STR APR_EOL_STR "# Send email to interested parties, let them know a lock was created:" APR_EOL_STR "mailer.py lock \"$REPOS\" \"$USER\" /path/to/mailer.conf" APR_EOL_STR; SVN_ERR_W(svn_io_file_create(this_path, contents, pool), "Creating post-lock hook"); } /* end post-lock hook */ /* Post-unlock hook. */ { this_path = apr_psprintf(pool, "%s%s", svn_repos_post_unlock_hook(repos, pool), SVN_REPOS__HOOK_DESC_EXT); contents = "#!/bin/sh" APR_EOL_STR APR_EOL_STR "# POST-UNLOCK HOOK" APR_EOL_STR "#" APR_EOL_STR "# The post-unlock hook runs after a path is unlocked. Subversion runs" APR_EOL_STR "# this hook by invoking a program (script, executable, binary, etc.)" APR_EOL_STR "# named '" SVN_REPOS__HOOK_POST_UNLOCK "' (for which this file is a template) with the " APR_EOL_STR "# following ordered arguments:" APR_EOL_STR "#" APR_EOL_STR "# [1] REPOS-PATH (the path to this repository)" APR_EOL_STR "# [2] USER (the user who destroyed the lock)" APR_EOL_STR "#" APR_EOL_STR "# The paths that were just unlocked are passed to the hook via STDIN" APR_EOL_STR "# (as of Subversion 1.2, only one path is passed per invocation, but" APR_EOL_STR "# the plan is to pass all unlocked paths at once, so the hook program" APR_EOL_STR "# should be written accordingly)." APR_EOL_STR "#" APR_EOL_STR "# The default working directory for the invocation is undefined, so" APR_EOL_STR "# the program should set one explicitly if it cares." APR_EOL_STR "#" APR_EOL_STR "# Because the lock has already been destroyed and cannot be undone," APR_EOL_STR "# the exit code of the hook program is ignored." APR_EOL_STR "#" APR_EOL_STR "# On a Unix system, the normal procedure is to have " "'" SVN_REPOS__HOOK_POST_UNLOCK "'" APR_EOL_STR "# invoke other programs to do the real work, though it may do the" APR_EOL_STR "# work itself too." APR_EOL_STR "#" APR_EOL_STR "# Note that" " '" SVN_REPOS__HOOK_POST_UNLOCK "' " "must be executable by the user(s) who will" APR_EOL_STR "# invoke it (typically the user httpd runs as), and that user must" APR_EOL_STR "# have filesystem-level permission to access the repository." APR_EOL_STR "#" APR_EOL_STR "# On a Windows system, you should name the hook program" APR_EOL_STR "# '" SVN_REPOS__HOOK_POST_UNLOCK ".bat' or " "'" SVN_REPOS__HOOK_POST_UNLOCK ".exe'," APR_EOL_STR "# but the basic idea is the same." APR_EOL_STR "# " APR_EOL_STR "# Here is an example hook script, for a Unix /bin/sh interpreter:" APR_EOL_STR APR_EOL_STR "REPOS=\"$1\"" APR_EOL_STR "USER=\"$2\"" APR_EOL_STR APR_EOL_STR "# Send email to interested parties, let them know a lock was removed:" APR_EOL_STR "mailer.py unlock \"$REPOS\" \"$USER\" /path/to/mailer.conf" APR_EOL_STR; SVN_ERR_W(svn_io_file_create(this_path, contents, pool), "Creating post-unlock hook"); } /* end post-unlock hook */ /* Post-revprop-change hook. */ { this_path = apr_psprintf(pool, "%s%s", svn_repos_post_revprop_change_hook(repos, pool), SVN_REPOS__HOOK_DESC_EXT); contents = "#!/bin/sh" APR_EOL_STR APR_EOL_STR "# POST-REVPROP-CHANGE HOOK" APR_EOL_STR "#" APR_EOL_STR "# The post-revprop-change hook is invoked after a revision property" APR_EOL_STR
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -