Mercurial > kallithea
annotate rhodecode/config/post_receive_tmpl.py @ 4147:1c8f818787b3 rhodecode-2.2.5-gpl
old style: show the full link box on summary page - no overlap or truncation
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Wed, 02 Jul 2014 19:03:23 -0400 |
parents | ffd45b185016 |
children | 7e5f8c12a3fc |
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 |
2617
c0ec29b20eb6
Fixed githooks for fetching multiple tags and branches.
Marcin Kuzminski <marcin@python-works.com>
parents:
2411
diff
changeset
|
7 RC_HOOK_VER = '_TMPL_' |
c0ec29b20eb6
Fixed githooks for fetching multiple tags and branches.
Marcin Kuzminski <marcin@python-works.com>
parents:
2411
diff
changeset
|
8 os.environ['RC_HOOK_VER'] = RC_HOOK_VER |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
9 from rhodecode.lib.hooks import handle_git_post_receive as _handler |
2402
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
10 except ImportError: |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
11 if os.environ.get('RC_DEBUG_GIT_HOOK'): |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
12 import traceback |
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
13 print traceback.format_exc() |
2402
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
14 rhodecode = None |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
15 |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
16 |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
17 def main(): |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
18 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
|
19 # 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
|
20 # 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
|
21 # rhodecode |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
22 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
|
23 |
2409
761e00380370
whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2404
diff
changeset
|
24 repo_path = os.path.abspath('.') |
2617
c0ec29b20eb6
Fixed githooks for fetching multiple tags and branches.
Marcin Kuzminski <marcin@python-works.com>
parents:
2411
diff
changeset
|
25 push_data = sys.stdin.readlines() |
2402
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 # 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
|
27 # runs git and later git executes this hook. |
4089
a5888ca796b5
Fixed spelling of get's to gets
Marcin Kuzminski <marcin@python-works.com>
parents:
2617
diff
changeset
|
28 # Environ gets some additional info from rhodecode system |
2402
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 # like IP or username from basic-auth |
4116
ffd45b185016
Imported some of the GPLv3'd changes from RhodeCode v2.2.5.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents:
4089
diff
changeset
|
30 _handler(repo_path, push_data, os.environ) |
2402
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
31 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
|
32 |
2eeb2ed72e55
Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 if __name__ == '__main__': |
2409
761e00380370
whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents:
2404
diff
changeset
|
34 main() |