Mercurial > kallithea
annotate rhodecode/config/post_receive_tmpl.py @ 2411:d3978233fcfa beta
chmod the hooks to 755, like all other githooks.
fix hook template name
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Thu, 07 Jun 2012 13:09:07 +0200 |
parents | rhodecode/config/pre_receive_tmpl.py@761e00380370 |
children | c0ec29b20eb6 |
rev | line source |
---|---|
2402
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 #!/usr/bin/env python |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 import os |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 import sys |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
4 |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
5 try: |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
6 import rhodecode |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 from rhodecode.lib.hooks import handle_git_post_receive |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 except ImportError: |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 rhodecode = None |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
11 |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
12 def main(): |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
13 if rhodecode is None: |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 # exit with success if we cannot import rhodecode !! |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
15 # this allows simply push to this repo even without |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 # rhodecode |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 sys.exit(0) |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
18 |
2409
761e00380370
whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2404
diff
changeset
|
19 repo_path = os.path.abspath('.') |
2402
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
20 push_data = sys.stdin.read().strip().split(' ') |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
21 # os.environ is modified here by a subprocess call that |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
22 # runs git and later git executes this hook. |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 # Environ get's some additional info from rhodecode system |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 # like IP or username from basic-auth |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
25 handle_git_post_receive(repo_path, push_data, os.environ) |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 sys.exit(0) |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 if __name__ == '__main__': |
2409
761e00380370
whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2404
diff
changeset
|
29 main() |