aboutsummaryrefslogtreecommitdiffstats
path: root/local/handler/GitlabPushHandler.py
blob: 84574ed70a4b604609a7738340f5e2ba7f9029f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from ..utility import *

def handle(data, theme):
    commitno = len(data['commits'])
    ref = data['ref'].split('/', 2)
    branch = ref[2]

    pushVisible = configValue("hidePush") == False
    pushUrl = "{}/-/compare/{}...{}".format(
        data['repository']['homepage'],
        data['before'],
        data['after']
    )
    if pushVisible:
        theme.push(
            branch = branch,
            actor = data['user_username'],
            url = getShortURL(pushUrl),
            count = commitno,
            forced = False
        )

    for commit in data['commits']:
        theme.commit(
            branch = branch,
            author = commit['author']['name'],
            id = commit['id'],
            message = commit['message'],
            url = getShortURL(commit['url'])
        )

    return True

© 2014-2024 Faster IT GmbH | imprint | privacy policy