Mercurial > kallithea
comparison rhodecode/config/pre_receive_tmpl.py @ 2726:aa17c7a1b8a5 beta
Implemented basic locking functionality.
- Reimplemented how githooks behave
- emaulate pre-receive hook
- install missing git hooks if they aren't already in repo
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Wed, 22 Aug 2012 00:30:02 +0200 |
parents | |
children | a5888ca796b5 |
comparison
equal
deleted
inserted
replaced
2725:3853e37db97c | 2726:aa17c7a1b8a5 |
---|---|
1 #!/usr/bin/env python | |
2 import os | |
3 import sys | |
4 | |
5 try: | |
6 import rhodecode | |
7 RC_HOOK_VER = '_TMPL_' | |
8 os.environ['RC_HOOK_VER'] = RC_HOOK_VER | |
9 from rhodecode.lib.hooks import handle_git_pre_receive | |
10 except ImportError: | |
11 rhodecode = None | |
12 | |
13 | |
14 def main(): | |
15 if rhodecode is None: | |
16 # exit with success if we cannot import rhodecode !! | |
17 # this allows simply push to this repo even without | |
18 # rhodecode | |
19 sys.exit(0) | |
20 | |
21 repo_path = os.path.abspath('.') | |
22 push_data = sys.stdin.readlines() | |
23 # os.environ is modified here by a subprocess call that | |
24 # runs git and later git executes this hook. | |
25 # Environ get's some additional info from rhodecode system | |
26 # like IP or username from basic-auth | |
27 handle_git_pre_receive(repo_path, push_data, os.environ) | |
28 sys.exit(0) | |
29 | |
30 if __name__ == '__main__': | |
31 main() |