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