Mercurial > kallithea
changeset 6591:167df0c8d191
lib: fix Git hook failure after TG2 port
This fixes manual_test_vcs_operations.py failures after e1ab82613133 dropped
test_env and test_index parameters to load_environment without fixing
handle_git_receive().
author | Anton Schur <tonich.sh@gmail.com> |
---|---|
date | Mon, 10 Apr 2017 13:15:52 +0300 |
parents | 6e11022b00f8 |
children | a844ea41da7e |
files | kallithea/lib/hooks.py |
diffstat | 1 files changed, 7 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/lib/hooks.py Fri Apr 14 02:12:09 2017 +0200 +++ b/kallithea/lib/hooks.py Mon Apr 10 13:15:52 2017 +0300 @@ -367,9 +367,11 @@ def handle_git_pre_receive(repo_path, revs, env): return handle_git_receive(repo_path, revs, env, hook_type='pre') + def handle_git_post_receive(repo_path, revs, env): return handle_git_receive(repo_path, revs, env, hook_type='post') + def handle_git_receive(repo_path, revs, env, hook_type): """ A really hacky method that is run by git post-receive hook and logs @@ -386,14 +388,15 @@ from kallithea.config.environment import load_environment from kallithea.model.base import init_model from kallithea.model.db import Ui - from kallithea.lib.utils import make_ui + from kallithea.lib.utils import make_ui, setup_cache_regions extras = _extract_extras(env) repo_path = safe_unicode(repo_path) path, ini_name = os.path.split(extras['config']) conf = appconfig('config:%s' % ini_name, relative_to=path) - conf = load_environment(conf.global_conf, conf.local_conf, test_env=False, - test_index=False) + conf = load_environment(conf.global_conf, conf.local_conf) + + setup_cache_regions(conf) engine = engine_from_config(conf, 'sqlalchemy.') init_model(engine) @@ -413,7 +416,7 @@ if hook_type == 'pre': repo = repo.scm_instance else: - #post push shouldn't use the cached instance never + # post push shouldn't use the cached instance never repo = repo.scm_instance_no_cache() if hook_type == 'pre':