annotate rhodecode/config/post_receive_tmpl.py @ 3206:d4bb8de7382f beta

top menu: show user menu when hovering instead of using js - like other menus
author Mads Kiilerich <madski@unity3d.com>
date Wed, 23 Jan 2013 20:26:34 +0100
parents c0ec29b20eb6
children a5888ca796b5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
2402
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
9 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
10 except ImportError:
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11 rhodecode = None
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
13
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 def main():
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15 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
16 # 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
17 # 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
18 # rhodecode
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19 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
20
2409
761e00380370 whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2404
diff changeset
21 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
22 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
23 # 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
24 # 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
25 # 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
26 # 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
27 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
28 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
29
2eeb2ed72e55 Added handling of git hooks, extract pushed revisions and store them inside
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
30 if __name__ == '__main__':
2409
761e00380370 whitespace cleanup
Marcin Kuzminski <marcin@python-works.com>
parents: 2404
diff changeset
31 main()