##// END OF EJS Templates
release: Release 5.2.0
release: Release 5.2.0

File last commit:

r1266:6139e442 merge v5.1.0 stable
r1292:50174967 merge v5.2.0 stable
Show More
svn_post_commit_hook.py.tmpl
59 lines | 1.5 KiB | application/x-cheetah | CheetahLexer
svn: added support for hooks management of git and subversion....
r407 #!_ENV_
import os
import sys
path_adjust = [_PATH_]
if path_adjust:
sys.path = path_adjust
fix(svn): svn events fixes
r1261 # special trick to pass in some information from rc to hooks
# mod_dav strips ALL env vars and we can't even access things like PATH
for env_k, env_v in _OS_EXPAND_:
os.environ[env_k] = env_v
svn: added support for hooks management of git and subversion....
r407 try:
from vcsserver import hooks
except ImportError:
if os.environ.get('RC_DEBUG_SVN_HOOK'):
import traceback
hooks: fixed python3 compat
r1077 print(traceback.format_exc())
svn: added support for hooks management of git and subversion....
r407 hooks = None
# TIMESTAMP: _DATE_
RC_HOOK_VER = '_TMPL_'
merge: Resolved conflicts
r1266 # special trick to pass in some information from rc to hooks
# mod_dav strips ALL env vars and we can't even access things like PATH
for env_k, env_v in _OS_EXPAND_:
os.environ[env_k] = env_v
svn: added support for hooks management of git and subversion....
r407 def main():
if hooks is None:
# exit with success if we cannot import vcsserver.hooks !!
# this allows simply push to this repo even without rhodecode
sys.exit(0)
hooks: allow skip hooks seperately for git and svn
r435 if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_SVN_HOOKS'):
svn: added support for hooks management of git and subversion....
r407 sys.exit(0)
fix(svn): svn events fixes
r1261 cwd_repo_path = os.getcwd()
svn: added support for hooks management of git and subversion....
r407 push_data = sys.argv[1:]
os.environ['RC_HOOK_VER'] = RC_HOOK_VER
try:
fix(svn): svn events fixes
r1261 result = hooks.svn_post_commit(cwd_repo_path, push_data, os.environ)
svn: added support for hooks management of git and subversion....
r407 sys.exit(result)
except Exception as error:
# TODO: johbo: Improve handling of this special case
if not getattr(error, '_vcs_kind', None) == 'repo_locked':
raise
hooks: fixed python3 compat
r1077 print(f'ERROR: {error}')
svn: added support for hooks management of git and subversion....
r407 sys.exit(1)
sys.exit(0)
if __name__ == '__main__':
main()