summaryrefslogtreecommitdiff
path: root/changelogs
blob: 1077a0363921f3aba2721d38a7d5317a859dc596 (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
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
#!/usr/bin/pypy
# -*- python -*-
#
# Go munging through changelogs for interesting info.
#
# git log <whatever> | changelogs
#
import gitlog
import sys

#
# Stats gathering.
#
EmptyCulprits = { }
SingleSSCulprits = { }
NoSOBCulprits = { }

def LogEmptyCulprit(culprit):
    try:
        EmptyCulprits[culprit] += 1
    except KeyError:
        EmptyCulprits[culprit] = 1

def LogSSCulprit(culprit):
    try:
        SingleSSCulprits[culprit] += 1
    except KeyError:
        SingleSSCulprits[culprit] = 1

def LogNoSOBCulprit(culprit):
    try:
        NoSOBCulprits[culprit] += 1
    except KeyError:
        NoSOBCulprits[culprit] = 1

def SortedCulprits(culprits):
    def compare(c1, c2):
        return culprits[c2] - culprits[c1]
    names = culprits.keys()
    names.sort(compare)
    return names

def PrintCulprits(culprits, sorted):
    for name in sorted:
        print '\t%30s: %d' % (name, culprits[name])
#
# Patch logging
#
SSPatches = { }
EmptyCLPatches = { }
NoSOBPatches = { }

def LogSSPatch(p):
    LogSSCulprit(p.author.name)
    try:
        SSPatches[p.author.name].append(p)
    except KeyError:
        SSPatches[p.author.name] = [p]

def LogECLPatch(p):
    LogEmptyCulprit(p.author.name)
    try:
        EmptyCLPatches[p.author.name].append(p)
    except KeyError:
        EmptyCLPatches[p.author.name] = [p]

def LogNoSOB(p):
    LogNoSOBCulprit(p.author.name)
    try:
        NoSOBPatches[p.author.name].append(p)
    except KeyError:
        NoSOBPatches[p.author.name] = [p]

LinusURL = 'http://git.kernel.org/linus/'
def WritePatches(names, patches, file):
    out = open(file, 'w')
    for name in names:
        out.write('<h4>%s</h4>\n<ul>\n' % name)
        for p in patches[name]:
            out.write('\t<li><a href="%s%s"><tt>%s</tt></a> %s\n' % (LinusURL,
                                                                     p.commit,
                                                                     p.commit,
                                                                     p.desc))
        out.write('</ul>\n\n')
    out.close()                     

#
# Main program.
#
Npatches = 0
NemptyCL = 0

Nsinglesob = 0
Nnosob = 0
Nothers = 0

p = gitlog.grabpatch(sys.stdin)
while p:
    #print p.commit, len(p.changelog)
    Npatches += 1
    if len(p.changelog) == 0:
        NemptyCL += 1
        LogECLPatch(p)
    if len(p.signoffs) == 0:
        Nnosob += 1
        LogNoSOB(p)
    elif len(p.signoffs) == 1:
        Nsinglesob += 1
        if p.othertags == 0:
            LogSSPatch(p)
        else:
            Nothers += 1
    p = gitlog.grabpatch(sys.stdin)

print '%d patches, %d w/o changelog' % (Npatches, NemptyCL)
print '  %d w/o signoff, %d w/1 signoff, %d no others, %d SS culprits' % \
      (Nnosob, Nsinglesob, Nsinglesob - Nothers, len(SingleSSCulprits))
print '\nMost single signoffs:'
sorted = SortedCulprits(SingleSSCulprits)[:20]
PrintCulprits(SingleSSCulprits, sorted)
WritePatches(sorted, SSPatches, 'sspatches.html')

print '\nMost empty changelogs:'
sorted = SortedCulprits(EmptyCulprits)[:20]
PrintCulprits(EmptyCulprits, sorted)
WritePatches(sorted, EmptyCLPatches, 'emptypatches.html')

print '\nNoSOB:'
sorted = SortedCulprits(NoSOBCulprits)
PrintCulprits(NoSOBCulprits, sorted)
WritePatches(sorted, NoSOBPatches, 'nosobpatches.html')