##// END OF EJS Templates
py3: automatic migration with 2to3 -f unicode
py3: automatic migration with 2to3 -f unicode

File last commit:

r7718:0a277465 default
r8093:e63bcce1 default
Show More
pre_receive_tmpl.py
37 lines | 1.0 KiB | text/x-python | PythonLexer
"""Kallithea Git hook
This hook is installed and maintained by Kallithea. It will be overwritten
by Kallithea - don't customize it manually!
When Kallithea invokes Git, the KALLITHEA_EXTRAS environment variable will
contain additional info like the Kallithea instance and user info that this
hook will use.
"""
import os
import sys
import kallithea.lib.hooks
# Set output mode on windows to binary for stderr.
# This prevents python (or the windows console) from replacing \n with \r\n.
# Git doesn't display remote output lines that contain \r,
# and therefore without this modification git would display empty lines
# instead of the exception output.
if sys.platform == "win32":
import msvcrt
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
KALLITHEA_HOOK_VER = '_TMPL_'
os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
def main():
repo_path = os.path.abspath('.')
git_stdin_lines = sys.stdin.readlines()
sys.exit(kallithea.lib.hooks.handle_git_pre_receive(repo_path, git_stdin_lines))
if __name__ == '__main__':
main()