summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2013-08-16 13:08:15 -0600
committerJonathan Corbet <corbet@lwn.net>2013-08-16 13:08:15 -0600
commit2505052891931d2e12497cb2e2bd5ed5e11adaed (patch)
treed3b02e4dc0f82df99844579cd021f98db8ab2382
parent38e47cb636ed8c8bea0dd7041b91158876d75031 (diff)
Add a "minversions" option
...a way to see how many new longer-term developers showed up in each cycle. Also switch to using accumulator.
-rwxr-xr-xfirstlast49
1 files changed, 29 insertions, 20 deletions
diff --git a/firstlast b/firstlast
index e46917c..3f39817 100755
--- a/firstlast
+++ b/firstlast
@@ -11,7 +11,7 @@ import sys
import gitlog
import database
import ConfigFile
-
+from utils import accumulator
#
# Arg processing
#
@@ -27,6 +27,8 @@ def SetupArgs():
required = False, default = '')
p.add_argument('-l', '--last', help = 'Last version for detailed tracking',
required = False, default = '')
+ p.add_argument('-m', '--minversions', required = False, default = 1, type = int,
+ help = 'How many versions an author contributes to for counting')
return p.parse_args()
#
@@ -118,9 +120,13 @@ VDB = pickle.load(open(args.versiondb, 'r'))
ConfigFile.ConfigFile(args.config, args.dbdir)
SetTrackingVersions(args)
-Firsts = { }
-Lasts = { }
-
+Firsts = accumulator()
+Lasts = accumulator()
+Singles = accumulator()
+Versions = accumulator()
+#
+# Read through the full patch stream and collect the relevant info.
+#
patch = gitlog.grabpatch(sys.stdin)
while patch:
try:
@@ -128,31 +134,26 @@ while patch:
except KeyError:
print 'Funky commit', patch.commit
continue
- try:
- x = patch.author.patches
- except AttributeError:
- print 'Attr err', patch.commit
- continue
#
# The first patch we see is the last they committed, since git
# lists things in backwards order.
#
if len(patch.author.patches) == 0:
patch.author.lastvers = v
- try:
- Lasts[v].append(patch.author)
- except KeyError:
- Lasts[v] = [patch.author]
+ Lasts.append(v, patch.author)
patch.author.firstvers = v
patch.author.addpatch(patch)
+ Versions.append(patch.author.id, v, unique = True)
patch = gitlog.grabpatch(sys.stdin)
+#
+# Pass over all the hackers we saw and collate stuff.
+#
for h in database.AllHackers():
- if len(h.patches) > 0:
- try:
- Firsts[h.firstvers].append(h)
- except KeyError:
- Firsts[h.firstvers] = [h]
+ if len(h.patches) > 0 and len(Versions[h.id]) >= args.minversions:
+ Firsts.append(h.firstvers, h)
+ if h.firstvers == h.lastvers:
+ Singles.incr(h.firstvers)
#
# Track details, but only for versions we care about
#
@@ -162,7 +163,15 @@ for h in database.AllHackers():
empl = h.emailemployer(p.email, p.date)
TrackFirstEmpl(empl.name)
-for v in Lasts.keys():
- print v, len(Firsts[v]), len(Lasts[v])
+versions = Lasts.keys()
+
+def cmpvers(v1, v2):
+ return versionmap(v2) - versionmap(v1)
+versions.sort(cmpvers)
+for v in versions:
+ if args.minversions <= 1:
+ print v, len(Firsts[v]), len(Lasts[v]), Singles[v]
+ else:
+ print v, len(Firsts.get(v, [])), len(Lasts.get(v, []))
PrintFirstDirs()
PrintFirstEmpls()