Changeset - 50906cedb924
[Not reviewed]
default
0 5 0
Mads Kiilerich (mads) - 5 years ago 2020-11-03 12:52:03
mads@kiilerich.com
Grafted from: c4999bd1ba66
hooks: clarify some comments
5 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
kallithea/config/middleware/simplegit.py
Show inline comments
 
@@ -89,7 +89,7 @@ class SimpleGit(BaseVCSController):
 
                baseui = make_ui()
 
                repo = db.Repository.get_by_repo_name(parsed_request.repo_name)
 
                scm_repo = repo.scm_instance
 
                # Run hooks, like Mercurial outgoing.pull_logger does
 
                # Run hooks like Mercurial outgoing.kallithea_log_pull_action does
 
                hooks.log_pull_action(ui=baseui, repo=scm_repo._repo)
 
            # Note: push hooks are handled by post-receive hook
 

	
kallithea/lib/hooks.py
Show inline comments
 
@@ -337,7 +337,7 @@ def handle_git_post_receive(repo_path, g
 
    try:
 
        baseui, repo = _hook_environment(repo_path)
 
    except HookEnvironmentError as e:
 
        sys.stderr.write("Skipping Kallithea Git post-recieve hook %r.\nGit was apparently not invoked by Kallithea: %s\n" % (sys.argv[0], e))
 
        sys.stderr.write("Skipping Kallithea Git post-receive hook %r.\nGit was apparently not invoked by Kallithea: %s\n" % (sys.argv[0], e))
 
        return 0
 

	
 
    # the post push hook should never use the cached instance
kallithea/lib/utils2.py
Show inline comments
 
@@ -493,11 +493,11 @@ def set_hook_environment(username, ip_ad
 
    Must always be called before anything with hooks are invoked.
 
    """
 
    extras = {
 
        'ip': ip_addr, # used in log_push/pull_action action_logger
 
        'ip': ip_addr, # used in action_logger
 
        'username': username,
 
        'action': action or 'push_local', # used in log_push_action_raw_ids action_logger
 
        'action': action or 'push_local', # used in process_pushed_raw_ids action_logger
 
        'repository': repo_name,
 
        'scm': repo_alias, # used to pick hack in log_push_action_raw_ids
 
        'scm': repo_alias,
 
        'config': kallithea.CONFIG['__file__'], # used by git hook to read config
 
    }
 
    os.environ['KALLITHEA_EXTRAS'] = json.dumps(extras)
kallithea/lib/vcs/ssh/base.py
Show inline comments
 
@@ -89,12 +89,12 @@ class BaseSshHandler(object):
 
        assert self.db_repo.repo_name == self.repo_name
 

	
 
        # Set global hook environment up for 'push' actions.
 
        # If pull actions should be served, the actual hook invocation will be
 
        # hardcoded to 'pull' when log_pull_action is invoked (directly on Git,
 
        # or through the Mercurial 'outgoing' hook).
 
        # For push actions, the action in global hook environment is used (in
 
        # handle_git_post_receive when it is called as Git post-receive hook,
 
        # or in log_push_action through the Mercurial 'changegroup' hook).
 
        # For push actions, the action in global hook environment is used in
 
        # process_pushed_raw_ids (which it is called as Git post-receive hook,
 
        # or Mercurial 'changegroup' hook).
 
        # For pull actions, the actual hook in log_pull_action (called directly
 
        # on Git, or through the 'outgoing' Mercurial hook) is hardcoded to
 
        # ignore the environment action and always use 'pull'.
 
        set_hook_environment(self.authuser.username, client_ip, self.repo_name, self.vcs_type, 'push')
 
        return self._serve()
 

	
kallithea/lib/vcs/ssh/git.py
Show inline comments
 
@@ -65,7 +65,7 @@ class GitSshHandler(base.BaseSshHandler)
 

	
 
    def _serve(self):
 
        if self.verb == 'git-upload-pack': # action 'pull'
 
            # base class called set_hook_environment - action is hardcoded to '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)
 
        else: # probably verb 'git-receive-pack', action 'push'
 
            if not self.allow_push:
0 comments (0 inline, 0 general)