##// END OF EJS Templates
git: fix git hook template mention of what hooks we actually execute....
marcink -
r2388:0df6dc22 default
parent child Browse files
Show More
@@ -1,46 +1,46 b''
1 1 #!_ENV_
2 2 import os
3 3 import sys
4 4
5 5 try:
6 6 from vcsserver import hooks
7 7 except ImportError:
8 8 if os.environ.get('RC_DEBUG_GIT_HOOK'):
9 9 import traceback
10 10 print traceback.format_exc()
11 11 hooks = None
12 12
13 13
14 14 RC_HOOK_VER = '_TMPL_'
15 15
16 16
17 17 def main():
18 18 if hooks is None:
19 # exit with success if we cannot import rhodecode.lib.hooks !!
19 # exit with success if we cannot import vcsserver.hooks !!
20 20 # this allows simply push to this repo even without rhodecode
21 21 sys.exit(0)
22 22
23 23 if os.environ.get('RC_SKIP_HOOKS'):
24 24 sys.exit(0)
25 25
26 26 repo_path = os.getcwd()
27 27 push_data = sys.stdin.readlines()
28 28 os.environ['RC_HOOK_VER'] = RC_HOOK_VER
29 29 # os.environ is modified here by a subprocess call that
30 30 # runs git and later git executes this hook.
31 31 # Environ gets some additional info from rhodecode system
32 32 # like IP or username from basic-auth
33 33 try:
34 34 result = hooks.git_post_receive(repo_path, push_data, os.environ)
35 35 sys.exit(result)
36 36 except Exception as error:
37 37 # TODO: johbo: Improve handling of this special case
38 38 if not getattr(error, '_vcs_kind', None) == 'repo_locked':
39 39 raise
40 40 print 'ERROR:', error
41 41 sys.exit(1)
42 42 sys.exit(0)
43 43
44 44
45 45 if __name__ == '__main__':
46 46 main()
@@ -1,46 +1,46 b''
1 1 #!_ENV_
2 2 import os
3 3 import sys
4 4
5 5 try:
6 6 from vcsserver import hooks
7 7 except ImportError:
8 8 if os.environ.get('RC_DEBUG_GIT_HOOK'):
9 9 import traceback
10 10 print traceback.format_exc()
11 11 hooks = None
12 12
13 13
14 14 RC_HOOK_VER = '_TMPL_'
15 15
16 16
17 17 def main():
18 18 if hooks is None:
19 # exit with success if we cannot import rhodecode.lib.hooks !!
19 # exit with success if we cannot import vcsserver.hooks !!
20 20 # this allows simply push to this repo even without rhodecode
21 21 sys.exit(0)
22 22
23 23 if os.environ.get('RC_SKIP_HOOKS'):
24 24 sys.exit(0)
25 25
26 26 repo_path = os.getcwd()
27 27 push_data = sys.stdin.readlines()
28 28 os.environ['RC_HOOK_VER'] = RC_HOOK_VER
29 29 # os.environ is modified here by a subprocess call that
30 30 # runs git and later git executes this hook.
31 31 # Environ gets some additional info from rhodecode system
32 32 # like IP or username from basic-auth
33 33 try:
34 34 result = hooks.git_pre_receive(repo_path, push_data, os.environ)
35 35 sys.exit(result)
36 36 except Exception as error:
37 37 # TODO: johbo: Improve handling of this special case
38 38 if not getattr(error, '_vcs_kind', None) == 'repo_locked':
39 39 raise
40 40 print 'ERROR:', error
41 41 sys.exit(1)
42 42 sys.exit(0)
43 43
44 44
45 45 if __name__ == '__main__':
46 46 main()
General Comments 0
You need to be logged in to leave comments. Login now