# HG changeset patch # User Mads Kiilerich # Date 1604328018 -3600 # Node ID 3f8cd215f5eb81e9f76c71718d9311d69aebd4e2 # Parent 50906cedb924942dc15a56bf43577238919a37fc hooks: don't pass arguments to log_pull_action when calling from git - it uses set_hook_environment diff -r 50906cedb924 -r 3f8cd215f5eb kallithea/config/middleware/simplegit.py --- a/kallithea/config/middleware/simplegit.py Tue Nov 03 12:52:03 2020 +0100 +++ b/kallithea/config/middleware/simplegit.py Mon Nov 02 15:40:18 2020 +0100 @@ -34,8 +34,6 @@ from kallithea.config.middleware.pygrack import make_wsgi_app from kallithea.lib import hooks from kallithea.lib.base import BaseVCSController, get_path_info -from kallithea.lib.utils import make_ui -from kallithea.model import db log = logging.getLogger(__name__) @@ -86,11 +84,8 @@ if (parsed_request.cmd == 'info/refs' and parsed_request.service == 'git-upload-pack' ): - baseui = make_ui() - repo = db.Repository.get_by_repo_name(parsed_request.repo_name) - scm_repo = repo.scm_instance # Run hooks like Mercurial outgoing.kallithea_log_pull_action does - hooks.log_pull_action(ui=baseui, repo=scm_repo._repo) + hooks.log_pull_action() # Note: push hooks are handled by post-receive hook return pygrack_app(environ, start_response) diff -r 50906cedb924 -r 3f8cd215f5eb kallithea/lib/hooks.py --- a/kallithea/lib/hooks.py Tue Nov 03 12:52:03 2020 +0100 +++ b/kallithea/lib/hooks.py Mon Nov 02 15:40:18 2020 +0100 @@ -83,7 +83,7 @@ ui.status(safe_bytes(msg)) -def log_pull_action(ui, repo, **kwargs): +def log_pull_action(*args, **kwargs): """Logs user last pull action Called as Mercurial hook outgoing.kallithea_log_pull_action or from Kallithea before invoking Git. diff -r 50906cedb924 -r 3f8cd215f5eb kallithea/lib/vcs/ssh/git.py --- a/kallithea/lib/vcs/ssh/git.py Tue Nov 03 12:52:03 2020 +0100 +++ b/kallithea/lib/vcs/ssh/git.py Mon Nov 02 15:40:18 2020 +0100 @@ -16,7 +16,6 @@ import os from kallithea.lib import hooks -from kallithea.lib.utils import make_ui from kallithea.lib.vcs.ssh import base @@ -66,7 +65,7 @@ def _serve(self): if self.verb == 'git-upload-pack': # action 'pull' # base class called set_hook_environment with 'push' action ... but log_pull_action ignores that and will 'pull' - hooks.log_pull_action(ui=make_ui(), repo=self.db_repo.scm_instance._repo) + hooks.log_pull_action() else: # probably verb 'git-receive-pack', action 'push' if not self.allow_push: self.exit('Push access to %r denied' % self.repo_name)