]> git.ozlabs.org Git - next-scripts/blob - do_stats
do_stats: create the mail message as well
[next-scripts] / do_stats
1 #!/bin/bash
2
3 base=$1
4 next=$2
5 rc=$3
6
7 # to stabilise the sorts
8 export LANG=C
9
10 sd=../stats
11
12 [ -d $sd ] || mkdir $sd || {
13         echo "No stats dir" 1>&2
14         exit 1
15 }
16
17 git rev-list --no-merges $base..$next | sort >$sd/$next.sha1s
18 git rev-list --no-merges $base..$rc | sort >$sd/$rc.sha1s
19
20 # filter out the common commits
21 comm -12 $sd/$next.sha1s $sd/$rc.sha1s >$sd/common_sha1
22 comm -23 $sd/$next.sha1s $sd/$rc.sha1s >$sd/$next.sha1s.1
23 comm -13 $sd/$next.sha1s $sd/$rc.sha1s >$sd/$rc.sha1s.1
24
25 # now find commits with the same patch-id
26 git diff-tree -p --stdin <$sd/$next.sha1s.1 |
27         git patch-id |
28         sort >$sd/$next.patch_ids
29 git diff-tree -p --stdin <$sd/$rc.sha1s.1 |
30         git patch-id |
31         sort >$sd/$rc.patch_ids
32 join -j 1 $sd/$next.patch_ids $sd/$rc.patch_ids >$sd/common_id
33 join -v 1 -j 1 $sd/$next.patch_ids $sd/$rc.patch_ids |
34         sed 's/^.* //' >$sd/$next.sha1s.2
35 join -v 2 -j 1 $sd/$next.patch_ids $sd/$rc.patch_ids |
36         sed 's/^.* //' >$sd/$rc.sha1s.2
37
38 # now find commits with the same subject line
39 git log --stdin --no-walk --format='%s|%H' <$sd/$next.sha1s.2 |
40         sed 's/|\(.*\)|/_\1|/g' |
41         sort -f -k 1,1 -t '|' >$sd/$next.subj
42 git log --stdin --no-walk --format='%s|%H' <$sd/$rc.sha1s.2 |
43         sed 's/|\(.*\)|/_\1|/g' |
44         sort -f -k 1,1 -t '|' >$sd/$rc.subj
45 join -i -j 1 -t '|' $sd/$next.subj $sd/$rc.subj >$sd/common_subj
46 join -v 1 -i -j 1 -t '|' $sd/$next.subj $sd/$rc.subj |
47         sed 's/^.*|//' >$sd/$next.sha1s.3
48 join -v 2 -i -j 1 -t '|' $sd/$next.subj $sd/$rc.subj |
49         sed 's/^.*|//' >$sd/$rc.sha1s.3
50
51 nrc=$(wc -l <$sd/$rc.sha1s)
52 nnext=$(wc -l <$sd/$next.sha1s)
53 ncommsha1=$(wc -l <$sd/common_sha1)
54 ncommid=$(wc -l <$sd/common_id)
55 ncommsubj=$(wc -l <$sd/common_subj)
56 ncomm=$((ncommsha1+ncommid+ncommsibj))
57 pcomm=$((ncomm*100/nrc))
58
59 cat <<EOF
60 Hi all,
61
62 As usual, the executive friendly graph is at
63 http://neuling.org/linux-next-size.html :-)
64
65 (No merge commits counted, $next was the first linux-next after
66 the merge window opened.)
67
68 EOF
69 printf "%-50s %5d\n" "Commits in $rc (relative to $base):" $nrc
70 printf "%-50s %5d\n" "Commits in $next:" $nnext
71 printf "%-50s %5d\n" "Commits with the same SHA1:" $ncommsha1
72 printf "%-50s %5d (1)\n" "Commits with the same patch_id:" $ncommid
73 printf "%-50s %5d (1)\n" "Commits with the same subject line:" $ncommsubj
74
75 cat <<EOF
76
77 (1) not counting those in the lines above.
78
79 EOF
80
81 printf "%-50s %5d %2d%%\n" "So commits in -rc1 that were in $next:" $ncomm $pcomm
82
83 cat <<EOF
84
85 Some breakdown of the list of extra commits (relative to $next)
86 in -rc1:
87
88 Top ten first word of commit summary:
89
90 $(git log --no-walk --stdin --pretty="format:%s" <$sd/$rc.sha1s.3 |
91         sed -e 's/^\[//;s/[]:( /,;].*$//' |
92         tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | head -n 10)
93
94 Top ten authors:
95
96 $(git log --no-walk --stdin --pretty="format:%aE" <$sd/$rc.sha1s.3 |
97         tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | head -n 10)
98
99 Top ten commiters:
100
101 $(git log --no-walk --stdin --pretty="format:%cE" <$sd/$rc.sha1s.3 |
102         tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | head -n 10)
103
104 There are also $(wc -l <$sd/$next.sha1s.3) commits in $next that didn't make it into
105 $rc.
106
107 Top ten first word of commit summary:
108
109 $(git log --no-walk --stdin --pretty="format:%s" <$sd/$next.sha1s.3 |
110         sed -e 's/^\[//;s/[]:( /,;].*$//' |
111         tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | head -n 10)
112
113 Top ten authors:
114
115 $(git log --no-walk --stdin --pretty="format:%aE" <$sd/$next.sha1s.3 |
116         tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | head -n 10)
117
118 Some of Andrew's patches are fixes for other patches in his tree (and
119 have been merged into those).
120
121 Top ten commiters:
122
123 $(git log --no-walk --stdin --pretty="format:%cE" <$sd/$next.sha1s.3 |
124         tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | head -n 10)
125
126 Those commits by me are from the quilt series (mainly Andrew's mmotm
127 tree).
128 EOF