Contributed work statistic from git
- From: Milan Crha <mcrha redhat com>
- To: gnome-bugsquad gnome org
- Subject: Contributed work statistic from git
- Date: Thu, 14 Jan 2010 16:41:56 +0100
Hello,
I was reading last year bugzilla statistics and even was one of those
listed in patch contribution. Thinking of that I consider that part
unfair, because it penalizes those committing directly, as they are
usually not attaching patches to bugzilla.
My idea is to create a "Contribution Top 10" from commits for a given
time period. Together with a little distinction between commits with a
bug reference and without it.
Because I'm not a python educated person, I asked my co-worker, Daniel
Mach, to help me with this task, and the result is in the attached file.
It's using a git-log to get logs for a given time period and gets the
information from it.
We did this as the first step, and it seems to create correct data. Of
course, it includes commits for version change for releases or
translators commits, but I do not consider it a problem, especially when
there are two Top 10, with and without a bug reference in a commit. Also
it does that on an actual branch, which, from my point of view, should
be only the master branch.
There are two things about it:
a) the list of modules is a static list, used as a name of a directory
where the git repo is stored
b) as it's using a git repo, it requires a local clone of it
Mainly the b) is a problem, and a reason for this mail:
Is it possible to run this script on some server, for all the gnome
modules, once a year, and include this kind of statistic in a yearly
stat mail Andre sends, together with those from bugzilla?
I do not know anything about Gnome internals, but it seems to me like a
good idea to run such a tool on a server, where necessary data are
already stored.
Feel free to change the script in any way.
Thanks and bye,
Milan
#!/usr/bin/python
# Author: Daniel Mach <dmach at redhat.com>
# 2010-01-14
import subprocess
dt_start = "2009-01-01"
dt_end = "2009-12-31"
modules = [
'evolution',
'evolution-data-server',
'evolutionexchange',
'evolutionmapi',
'gtkhtml',
]
names = {}
bugs = {}
no_bugs = {}
total_count = 0
def parse_data(data):
global names
global bugs
global no_bugs
global total_count
split_data = data.strip().split("<FF>")
for i in split_data:
item = [i.strip() for i in i.strip().split("\n", 3)]
if item == [""]:
continue
if len(item) != 4:
print "invalid item: %s" % item
continue
date, name, email, text = item
names[email] = name
if 'bug' in text.lower():
bugs.setdefault(email, 0)
bugs[email] += 1
no_bugs.setdefault(email, 0)
no_bugs[email] += 1
total_count += 1
def count_commits(items):
global names
commits_by_name = {}
for email, value in items.items():
commits_by_name.setdefault(names[email], 0)
commits_by_name[names[email]] += value
for value, name in sorted([ i[::-1] for i in commits_by_name.items()], reverse=True)[:10]:
print "%-40s %s" % (name, value)
for module in modules:
proc = subprocess.Popen(["git", "log", "--since=%s" % dt_start, "--until=%s" % dt_end, '--pretty=format:%ai%n %aN%n %aE%n %s%n %b%n <FF>%n'], cwd=module, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = ""
while proc.poll() is None:
output += proc.stdout.read()
output += proc.stdout.read()
parse_data(output)
print "Bugs:"
count_commits(bugs)
print
print 80 * "-"
print
print "Bugs + no bugs:"
count_commits(no_bugs)
print
print "Total commits read: %d" % total_count
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]