File: generate-authors.sh

package info (click to toggle)
darktable 5.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 64,644 kB
  • sloc: ansic: 367,957; cpp: 102,838; xml: 20,091; lisp: 15,092; sh: 3,767; javascript: 3,264; perl: 1,925; python: 1,551; ruby: 975; makefile: 543; asm: 46; sql: 38; awk: 21
file content (161 lines) | stat: -rwxr-xr-x 4,143 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/bin/bash
#
#   This file is part of darktable,
#   Copyright (C) 2019-2020 darktable developers.
#
#   darktable is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   darktable is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with darktable.  If not, see <http://www.gnu.org/licenses/>.
#

CDPATH=
BASE=$1
HEAD=${2:-HEAD}

# minimal number of commits an author should have, to be listed at all
SHORTLOG_THRESHOLD=1

# minimal number of commits translator should have, to be listed
TRANSLATOR_THRESHOLD=1

# minimal number of commits regular contributor should have, to be listed
CONTRIBUTOR_THRESHOLD=4

# these will not be shown in contributors section.
ALL_DEVELOPERS=("Aldric Renaudin"
                "Alexandre Prokoudine"
                "Christian Tellefsen"
                "Edouard Gomez"
                "Henrik Andersson"
                "James C. McPherson"
                "José Carlos García Sogo"
                "Jérémy Rosen"
                "Pascal Obry"
                "Pascal de Bruijn"
                "Pedro Côrte-Real"
                "Peter Budai"
                "Roman Lebedev"
                "Simon Spannagel"
                "Stefan Schöfegger"
                "Tobias Ellinghaus"
                "Ulrich Pegelow"
                "johannes hanika"
                "parafin"
                "Hanno Schwalm"
                "Victor Forsiuk"
                "Mario Zimmermann"
                "Ralf Brown")

function short-log()
{
    local RANGE="$1"
    local MIN=$2
    local PATHS="$3"

    git shortlog -ns $RANGE -- $PATHS |
        while read num auth; do
            if [ $num -ge $MIN ]; then
                echo $auth;
            fi;
        done
}

function for-submodule()
{
    local SUBPATH=$1
    local MIN=$2

    local SHEAD=$(git log --patch -1 $HEAD -- $SUBPATH | grep "Subproject commit" | tail -1 | cut -d' ' -f3)

    SRANGE=""

    if [ -z $BASE ]; then
        SRANGE=$SHEAD
    else
        local SBASE=$(git log --patch -1 $BASE -- $SUBPATH | grep "Subproject commit" | tail -1 | cut -d' ' -f3)

        if [[ -z $SBASE ]]; then
            SRANGE="$SHEAD"
        else
            SRANGE="$SBASE..$SHEAD"
        fi
    fi

    (
        cd $SUBPATH
        short-log "$SRANGE" $MIN
    )
}

function is-developer()
{
    local AUTH="$1"

    for i in "${ALL_DEVELOPERS[@]}"; do
        if [ "$i" == "$AUTH" ]; then
            return 1
        fi
    done

    return 0
}

RANGE=$HEAD

if [ ! -z $BASE ]; then
    RANGE=$BASE..$HEAD
fi

echo "* Developers:"

{
    short-log $RANGE $SHORTLOG_THRESHOLD |
        while read name; do
            is-developer "$name"
            if [ $? == 1 ]; then
                echo $name
            fi
        done

    short-log $RANGE $CONTRIBUTOR_THRESHOLD |
        while read name; do
            is-developer "$name"
            if [ $? == 0 ]; then
                echo $name
            fi
        done
} | grep -v "dependabot"

echo
echo "* Translators:"
short-log $RANGE $TRANSLATOR_THRESHOLD "./po/*.po ./doc/man/po/*.po ./doc/usermanual/po/*.po"

# handle sub-modules if any

if [ -f .gitmodules ]; then
    cat .gitmodules | grep path |
        while read x c module; do
            MODULE_NAME=$(basename $module)

            [[ ${MODULE_NAME} == "OpenCL" ]] ||
                [[ ${MODULE_NAME} == "libxcf" ]] ||
                [[ ${MODULE_NAME} == "whereami" ]] ||
                [[ ${MODULE_NAME} == "LibRaw" ]] && continue

            echo
            echo "* Sub-module $MODULE_NAME contributors (at least 1 commit):"
            for-submodule $module $SHORTLOG_THRESHOLD
        done
fi

echo
echo "And all those of you that made previous releases possible"