# HG changeset patch # User Marcin Kuzminski # Date 1346946848 -7200 # Node ID 3d0bd5f71dabeaaf02915b88fb0b9e798a9a262f # Parent 3ae42e10b6659584f8271cf786d03fb93478ccb6 raise na OSERROR if repository data sent from git hook to hook handler is somehow invalid diff -r 3ae42e10b665 -r 3d0bd5f71dab rhodecode/lib/hooks.py --- a/rhodecode/lib/hooks.py Thu Sep 06 11:32:36 2012 +0200 +++ b/rhodecode/lib/hooks.py Thu Sep 06 17:54:08 2012 +0200 @@ -34,10 +34,9 @@ from rhodecode.lib.utils import action_logger from rhodecode.lib.vcs.backends.base import EmptyChangeset from rhodecode.lib.compat import json -from rhodecode.model.db import Repository, User +from rhodecode.lib.exceptions import HTTPLockedRC from rhodecode.lib.utils2 import safe_str -from rhodecode.lib.exceptions import HTTPLockedRC - +from rhodecode.model.db import Repository, User def _get_scm_size(alias, root_path): @@ -330,7 +329,12 @@ # fix if it's not a bare repo if repo_path.endswith('.git'): repo_path = repo_path[:-4] + repo = Repository.get_by_full_path(repo_path) + if not repo: + raise OSError('Repository %s not found in database' + % (safe_str(repo_path))) + _hooks = dict(baseui.configitems('hooks')) or {} extras = json.loads(env['RHODECODE_EXTRAS'])