Show More
@@ -1,51 +1,51 b'' | |||
|
1 | 1 | #!_ENV_ |
|
2 | 2 | import os |
|
3 | 3 | import sys |
|
4 | 4 | path_adjust = [_PATH_] |
|
5 | 5 | |
|
6 | 6 | if path_adjust: |
|
7 | 7 | sys.path = path_adjust |
|
8 | 8 | |
|
9 | 9 | try: |
|
10 | 10 | from vcsserver import hooks |
|
11 | 11 | except ImportError: |
|
12 | 12 | if os.environ.get('RC_DEBUG_GIT_HOOK'): |
|
13 | 13 | import traceback |
|
14 | 14 | print traceback.format_exc() |
|
15 | 15 | hooks = None |
|
16 | 16 | |
|
17 | 17 | |
|
18 | 18 | # TIMESTAMP: _DATE_ |
|
19 | 19 | RC_HOOK_VER = '_TMPL_' |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | def main(): |
|
23 | 23 | if hooks is None: |
|
24 | 24 | # exit with success if we cannot import vcsserver.hooks !! |
|
25 | 25 | # this allows simply push to this repo even without rhodecode |
|
26 | 26 | sys.exit(0) |
|
27 | 27 | |
|
28 | if os.environ.get('RC_SKIP_HOOKS'): | |
|
28 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_GIT_HOOKS'): | |
|
29 | 29 | sys.exit(0) |
|
30 | 30 | |
|
31 | 31 | repo_path = os.getcwd() |
|
32 | 32 | push_data = sys.stdin.readlines() |
|
33 | 33 | os.environ['RC_HOOK_VER'] = RC_HOOK_VER |
|
34 | 34 | # os.environ is modified here by a subprocess call that |
|
35 | 35 | # runs git and later git executes this hook. |
|
36 | 36 | # Environ gets some additional info from rhodecode system |
|
37 | 37 | # like IP or username from basic-auth |
|
38 | 38 | try: |
|
39 | 39 | result = hooks.git_post_receive(repo_path, push_data, os.environ) |
|
40 | 40 | sys.exit(result) |
|
41 | 41 | except Exception as error: |
|
42 | 42 | # TODO: johbo: Improve handling of this special case |
|
43 | 43 | if not getattr(error, '_vcs_kind', None) == 'repo_locked': |
|
44 | 44 | raise |
|
45 | 45 | print 'ERROR:', error |
|
46 | 46 | sys.exit(1) |
|
47 | 47 | sys.exit(0) |
|
48 | 48 | |
|
49 | 49 | |
|
50 | 50 | if __name__ == '__main__': |
|
51 | 51 | main() |
@@ -1,51 +1,51 b'' | |||
|
1 | 1 | #!_ENV_ |
|
2 | 2 | import os |
|
3 | 3 | import sys |
|
4 | 4 | path_adjust = [_PATH_] |
|
5 | 5 | |
|
6 | 6 | if path_adjust: |
|
7 | 7 | sys.path = path_adjust |
|
8 | 8 | |
|
9 | 9 | try: |
|
10 | 10 | from vcsserver import hooks |
|
11 | 11 | except ImportError: |
|
12 | 12 | if os.environ.get('RC_DEBUG_GIT_HOOK'): |
|
13 | 13 | import traceback |
|
14 | 14 | print traceback.format_exc() |
|
15 | 15 | hooks = None |
|
16 | 16 | |
|
17 | 17 | |
|
18 | 18 | # TIMESTAMP: _DATE_ |
|
19 | 19 | RC_HOOK_VER = '_TMPL_' |
|
20 | 20 | |
|
21 | 21 | |
|
22 | 22 | def main(): |
|
23 | 23 | if hooks is None: |
|
24 | 24 | # exit with success if we cannot import vcsserver.hooks !! |
|
25 | 25 | # this allows simply push to this repo even without rhodecode |
|
26 | 26 | sys.exit(0) |
|
27 | 27 | |
|
28 | if os.environ.get('RC_SKIP_HOOKS'): | |
|
28 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_GIT_HOOKS'): | |
|
29 | 29 | sys.exit(0) |
|
30 | 30 | |
|
31 | 31 | repo_path = os.getcwd() |
|
32 | 32 | push_data = sys.stdin.readlines() |
|
33 | 33 | os.environ['RC_HOOK_VER'] = RC_HOOK_VER |
|
34 | 34 | # os.environ is modified here by a subprocess call that |
|
35 | 35 | # runs git and later git executes this hook. |
|
36 | 36 | # Environ gets some additional info from rhodecode system |
|
37 | 37 | # like IP or username from basic-auth |
|
38 | 38 | try: |
|
39 | 39 | result = hooks.git_pre_receive(repo_path, push_data, os.environ) |
|
40 | 40 | sys.exit(result) |
|
41 | 41 | except Exception as error: |
|
42 | 42 | # TODO: johbo: Improve handling of this special case |
|
43 | 43 | if not getattr(error, '_vcs_kind', None) == 'repo_locked': |
|
44 | 44 | raise |
|
45 | 45 | print 'ERROR:', error |
|
46 | 46 | sys.exit(1) |
|
47 | 47 | sys.exit(0) |
|
48 | 48 | |
|
49 | 49 | |
|
50 | 50 | if __name__ == '__main__': |
|
51 | 51 | main() |
@@ -1,50 +1,50 b'' | |||
|
1 | 1 | #!_ENV_ |
|
2 | 2 | |
|
3 | 3 | import os |
|
4 | 4 | import sys |
|
5 | 5 | path_adjust = [_PATH_] |
|
6 | 6 | |
|
7 | 7 | if path_adjust: |
|
8 | 8 | sys.path = path_adjust |
|
9 | 9 | |
|
10 | 10 | try: |
|
11 | 11 | from vcsserver import hooks |
|
12 | 12 | except ImportError: |
|
13 | 13 | if os.environ.get('RC_DEBUG_SVN_HOOK'): |
|
14 | 14 | import traceback |
|
15 | 15 | print traceback.format_exc() |
|
16 | 16 | hooks = None |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | # TIMESTAMP: _DATE_ |
|
20 | 20 | RC_HOOK_VER = '_TMPL_' |
|
21 | 21 | |
|
22 | 22 | |
|
23 | 23 | def main(): |
|
24 | 24 | if hooks is None: |
|
25 | 25 | # exit with success if we cannot import vcsserver.hooks !! |
|
26 | 26 | # this allows simply push to this repo even without rhodecode |
|
27 | 27 | sys.exit(0) |
|
28 | 28 | |
|
29 | if os.environ.get('RC_SKIP_HOOKS'): | |
|
29 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_SVN_HOOKS'): | |
|
30 | 30 | sys.exit(0) |
|
31 | 31 | repo_path = os.getcwd() |
|
32 | 32 | push_data = sys.argv[1:] |
|
33 | 33 | |
|
34 | 34 | os.environ['RC_HOOK_VER'] = RC_HOOK_VER |
|
35 | 35 | |
|
36 | 36 | try: |
|
37 | 37 | result = hooks.svn_post_commit(repo_path, push_data, os.environ) |
|
38 | 38 | sys.exit(result) |
|
39 | 39 | except Exception as error: |
|
40 | 40 | # TODO: johbo: Improve handling of this special case |
|
41 | 41 | if not getattr(error, '_vcs_kind', None) == 'repo_locked': |
|
42 | 42 | raise |
|
43 | 43 | print 'ERROR:', error |
|
44 | 44 | sys.exit(1) |
|
45 | 45 | sys.exit(0) |
|
46 | 46 | |
|
47 | 47 | |
|
48 | 48 | |
|
49 | 49 | if __name__ == '__main__': |
|
50 | 50 | main() |
@@ -1,52 +1,52 b'' | |||
|
1 | 1 | #!_ENV_ |
|
2 | 2 | |
|
3 | 3 | import os |
|
4 | 4 | import sys |
|
5 | 5 | path_adjust = [_PATH_] |
|
6 | 6 | |
|
7 | 7 | if path_adjust: |
|
8 | 8 | sys.path = path_adjust |
|
9 | 9 | |
|
10 | 10 | try: |
|
11 | 11 | from vcsserver import hooks |
|
12 | 12 | except ImportError: |
|
13 | 13 | if os.environ.get('RC_DEBUG_SVN_HOOK'): |
|
14 | 14 | import traceback |
|
15 | 15 | print traceback.format_exc() |
|
16 | 16 | hooks = None |
|
17 | 17 | |
|
18 | 18 | |
|
19 | 19 | # TIMESTAMP: _DATE_ |
|
20 | 20 | RC_HOOK_VER = '_TMPL_' |
|
21 | 21 | |
|
22 | 22 | |
|
23 | 23 | def main(): |
|
24 | 24 | if os.environ.get('SSH_READ_ONLY') == '1': |
|
25 | 25 | sys.stderr.write('Only read-only access is allowed') |
|
26 | 26 | sys.exit(1) |
|
27 | 27 | |
|
28 | 28 | if hooks is None: |
|
29 | 29 | # exit with success if we cannot import vcsserver.hooks !! |
|
30 | 30 | # this allows simply push to this repo even without rhodecode |
|
31 | 31 | sys.exit(0) |
|
32 | if os.environ.get('RC_SKIP_HOOKS'): | |
|
32 | if os.environ.get('RC_SKIP_HOOKS') or os.environ.get('RC_SKIP_SVN_HOOKS'): | |
|
33 | 33 | sys.exit(0) |
|
34 | 34 | repo_path = os.getcwd() |
|
35 | 35 | push_data = sys.argv[1:] |
|
36 | 36 | |
|
37 | 37 | os.environ['RC_HOOK_VER'] = RC_HOOK_VER |
|
38 | 38 | |
|
39 | 39 | try: |
|
40 | 40 | result = hooks.svn_pre_commit(repo_path, push_data, os.environ) |
|
41 | 41 | sys.exit(result) |
|
42 | 42 | except Exception as error: |
|
43 | 43 | # TODO: johbo: Improve handling of this special case |
|
44 | 44 | if not getattr(error, '_vcs_kind', None) == 'repo_locked': |
|
45 | 45 | raise |
|
46 | 46 | print 'ERROR:', error |
|
47 | 47 | sys.exit(1) |
|
48 | 48 | sys.exit(0) |
|
49 | 49 | |
|
50 | 50 | |
|
51 | 51 | if __name__ == '__main__': |
|
52 | 52 | main() |
General Comments 0
You need to be logged in to leave comments.
Login now