Changeset - 9bc1ee41df8c
[Not reviewed]
default
0 3 0
domruf - 8 years ago 2018-01-25 21:49:33
dominikruf@gmail.com
Grafted from: b6e09bf7852f
hooks: rename 'push_data' and 'revs' to git_stdin_lines

...to better reflect what it is.
3 files changed with 10 insertions and 10 deletions:
0 comments (0 inline, 0 general)
kallithea/config/post_receive_tmpl.py
Show inline comments
 
@@ -14,17 +14,17 @@ KALLITHEA_HOOK_VER = '_TMPL_'
 
os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
 
from kallithea.lib.hooks import handle_git_post_receive as _handler
 

	
 

	
 
def main():
 
    repo_path = os.path.abspath('.')
 
    push_data = sys.stdin.readlines()
 
    git_stdin_lines = sys.stdin.readlines()
 
    # os.environ is modified here by a subprocess call that
 
    # runs git and later git executes this hook.
 
    # Environ gets some additional info from kallithea system
 
    # like IP or username from basic-auth
 
    _handler(repo_path, push_data, os.environ)
 
    _handler(repo_path, git_stdin_lines, os.environ)
 
    sys.exit(0)
 

	
 

	
 
if __name__ == '__main__':
 
    main()
kallithea/config/pre_receive_tmpl.py
Show inline comments
 
@@ -14,17 +14,17 @@ KALLITHEA_HOOK_VER = '_TMPL_'
 
os.environ['KALLITHEA_HOOK_VER'] = KALLITHEA_HOOK_VER
 
from kallithea.lib.hooks import handle_git_pre_receive as _handler
 

	
 

	
 
def main():
 
    repo_path = os.path.abspath('.')
 
    push_data = sys.stdin.readlines()
 
    git_stdin_lines = sys.stdin.readlines()
 
    # os.environ is modified here by a subprocess call that
 
    # runs git and later git executes this hook.
 
    # Environ gets some additional info from kallithea system
 
    # like IP or username from basic-auth
 
    _handler(repo_path, push_data, os.environ)
 
    _handler(repo_path, git_stdin_lines, os.environ)
 
    sys.exit(0)
 

	
 

	
 
if __name__ == '__main__':
 
    main()
kallithea/lib/hooks.py
Show inline comments
 
@@ -361,21 +361,21 @@ def log_delete_user(user_dict, deleted_b
 
    if callable(callback):
 
        return callback(deleted_by=deleted_by, **user_dict)
 

	
 
    return 0
 

	
 

	
 
def handle_git_pre_receive(repo_path, revs, env):
 
    return handle_git_receive(repo_path, revs, env, hook_type='pre')
 
def handle_git_pre_receive(repo_path, git_stdin_lines, env):
 
    return handle_git_receive(repo_path, git_stdin_lines, env, hook_type='pre')
 

	
 

	
 
def handle_git_post_receive(repo_path, revs, env):
 
    return handle_git_receive(repo_path, revs, env, hook_type='post')
 
def handle_git_post_receive(repo_path, git_stdin_lines, env):
 
    return handle_git_receive(repo_path, git_stdin_lines, env, hook_type='post')
 

	
 

	
 
def handle_git_receive(repo_path, revs, env, hook_type):
 
def handle_git_receive(repo_path, git_stdin_lines, env, hook_type):
 
    """
 
    A really hacky method that is run by git post-receive hook and logs
 
    a push action together with pushed revisions. It's executed by subprocess
 
    thus needs all info to be able to create an on the fly app environment,
 
    connect to database and run the logging code. Hacky as sh*t but works.
 

	
 
@@ -422,13 +422,13 @@ def handle_git_receive(repo_path, revs, 
 
    if hook_type == 'pre':
 
        pre_push(baseui, repo)
 

	
 
    # if push hook is enabled via web interface
 
    elif hook_type == 'post' and _hooks.get(Ui.HOOK_PUSH):
 
        rev_data = []
 
        for l in revs:
 
        for l in git_stdin_lines:
 
            old_rev, new_rev, ref = l.strip().split(' ')
 
            _ref_data = ref.split('/')
 
            if _ref_data[1] in ['tags', 'heads']:
 
                rev_data.append({'old_rev': old_rev,
 
                                 'new_rev': new_rev,
 
                                 'ref': ref,
0 comments (0 inline, 0 general)