##// END OF EJS Templates
goto-switcher: optimized performance and query capabilities....
goto-switcher: optimized performance and query capabilities. - Previous implementation had on significant bug. The use of LIMIT 20 was limiting results BEFORE auth checks. In case of large ammount of similarly named repositories user didn't had access too, the result goto search was empty. This was becuase first 20 items fetched didn't pass permission checks and final auth list was empty. To fix this we now use proper filtering for auth using SQL. It means we first check user allowed repositories, and add this as a filter so end result from database is already to only the accessible repositories.

File last commit:

r1:854a839a default
r2038:2bdf9d4d default
Show More
git_post_receive.py.tmpl
46 lines | 1.2 KiB | application/x-cheetah | CheetahLexer
project: added all source files and assets
r1 #!_ENV_
import os
import sys
try:
from vcsserver import hooks
except ImportError:
if os.environ.get('RC_DEBUG_GIT_HOOK'):
import traceback
print traceback.format_exc()
hooks = None
RC_HOOK_VER = '_TMPL_'
def main():
if hooks is None:
# exit with success if we cannot import rhodecode.lib.hooks !!
# this allows simply push to this repo even without rhodecode
sys.exit(0)
if os.environ.get('RC_SKIP_HOOKS'):
sys.exit(0)
repo_path = os.getcwd()
push_data = sys.stdin.readlines()
os.environ['RC_HOOK_VER'] = RC_HOOK_VER
# os.environ is modified here by a subprocess call that
# runs git and later git executes this hook.
# Environ gets some additional info from rhodecode system
# like IP or username from basic-auth
try:
result = hooks.git_post_receive(repo_path, push_data, os.environ)
sys.exit(result)
except Exception as error:
# TODO: johbo: Improve handling of this special case
if not getattr(error, '_vcs_kind', None) == 'repo_locked':
raise
print 'ERROR:', error
sys.exit(1)
sys.exit(0)
if __name__ == '__main__':
main()