changeset 8744:3f8cd215f5eb

hooks: don't pass arguments to log_pull_action when calling from git - it uses set_hook_environment
author Mads Kiilerich <mads@kiilerich.com>
date Mon, 02 Nov 2020 15:40:18 +0100
parents 50906cedb924
children aa067dbcdc82
files kallithea/config/middleware/simplegit.py kallithea/lib/hooks.py kallithea/lib/vcs/ssh/git.py
diffstat 3 files changed, 3 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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.
--- 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)