]> git.proxmox.com Git - ceph.git/blob - ceph/src/script/credits.sh
import quincy beta 17.1.0
[ceph.git] / ceph / src / script / credits.sh
1 #!/usr/bin/env bash
2
3 range="$1"
4 TMP=/tmp/credits
5 declare -A mail2author
6 declare -A mail2organization
7 remap="s/'/ /g"
8 git log --pretty='%ae %aN <%aE>' $range | sed -e "$remap" | sort -u > $TMP
9 while read mail who ; do
10 author=$(echo $who | git -c mailmap.file=.peoplemap check-mailmap --stdin)
11 mail2author[$mail]="$author"
12 organization=$(echo $who | git -c mailmap.file=.organizationmap check-mailmap --stdin)
13 mail2organization[$mail]="$organization"
14 done < $TMP
15 declare -A author2lines
16 declare -A organization2lines
17 git log --no-merges --pretty='%ae' $range | sed -e "$remap" | sort -u > $TMP
18 while read mail ; do
19 count=$(git log --numstat --author="$mail" --pretty='%h' $range |
20 egrep -v 'package-lock\.json|\.xlf' | # generated files that should be excluded from line counting
21 perl -e 'while(<STDIN>) { if(/(\d+)\t(\d+)/) { $added += $1; $deleted += $2 } }; print $added + $deleted;')
22 (( author2lines["${mail2author[$mail]}"] += $count ))
23 (( organization2lines["${mail2organization[$mail]}"] += $count ))
24 done < $TMP
25 echo
26 echo "Number of lines added and removed, by authors"
27 for author in "${!author2lines[@]}" ; do
28 printf "%6s %s\n" ${author2lines["$author"]} "$author"
29 done | sort -rn | nl
30 echo
31 echo "Number of lines added and removed, by organization"
32 for organization in "${!organization2lines[@]}" ; do
33 printf "%6s %s\n" ${organization2lines["$organization"]} "$organization"
34 done | sort -rn | nl
35 echo
36 echo "Commits, by authors"
37 git log --no-merges --pretty='%aN <%aE>' $range | git -c mailmap.file=.peoplemap check-mailmap --stdin | sort | uniq -c | sort -rn | nl
38 echo
39 echo "Commits, by organizations"
40 git log --no-merges --pretty='%aN <%aE>' $range | git -c mailmap.file=.organizationmap check-mailmap --stdin | sort | uniq -c | sort -rn | nl
41 echo
42 echo "Reviews, by authors (one review spans multiple commits)"
43 git log --pretty=%b $range | perl -n -e 'print "$_\n" if(s/^\s*Reviewed-by:\s*(.*<.*>)\s*$/\1/i)' | git check-mailmap --stdin | git -c mailmap.file=.peoplemap check-mailmap --stdin | sort | uniq -c | sort -rn | nl
44 echo
45 echo "Reviews, by organizations (one review spans multiple commits)"
46 git log --pretty=%b $range | perl -n -e 'print "$_\n" if(s/^\s*Reviewed-by:\s*(.*<.*>)\s*$/\1/i)' | git check-mailmap --stdin | git -c mailmap.file=.organizationmap check-mailmap --stdin | sort | uniq -c | sort -rn | nl