summaryrefslogtreecommitdiffstats
path: root/extras/who-wrote-glusterfs/who-wrote-glusterfs.sh
blob: 7a1896e6a90fd9f3c6f664ce602db25142e2c5b6 (plain)
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
#!/bin/bash
#
# Gather statistics on "Who wrote GlusterFS". The idea comes from the excellent
# articles on http://lwn.net/ named "Who wrote <linux-version>?".
#
# gitdm comes from git://git.lwn.net/gitdm.git by Jonathan Corbet.
#
# Confguration files used:
#  - gitdm.config: main configuration file, pointing to the others
#  - gitdm.aliases: merge users with different emailaddresses into one
#  - gitdm.domain-map: map domain names from emailaddresses to companies
#

DIRNAME=$(dirname $0)

GITDM_REPO=git://git.lwn.net/gitdm.git
GITDM_DIR=${DIRNAME}/gitdm
GITDM_CMD="python ${GITDM_DIR}/gitdm"

error()
{
        local ret=${?}
        printf "${@}\n" > /dev/stderr
        return ${ret}
}

check_gitdm()
{
        if [ ! -e "${GITDM_DIR}/gitdm" ]
        then
                git clone --quiet git://git.lwn.net/gitdm.git ${DIRNAME}/gitdm
        fi
}

# The first argument is the revision-range (see 'git rev-list --help').
# REV can be empty, and the statistics will be calculated over the whole
# current branch.
REV=${1}
shift
# all remaining options are passed to gitdm, see the gitdm script for an
# explanation of the accepted options.
GITDM_OPTS=${@}

if ! check_gitdm
then
        error "Could not find 'gitdm', exiting..."
        exit 1
fi

git log --numstat -M ${REV} | ${GITDM_CMD} -b ${DIRNAME} -n ${GITDM_OPTS}