[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Info-cvs Digest, Vol 18, Issue 34

From: Matthew Herrmann
Subject: RE: Info-cvs Digest, Vol 18, Issue 34
Date: Thu, 20 May 2004 00:27:41 +1000


Run this python script from within a checked out sandbox. It will create a
file called table.txt. Load this file into excel and use PivotTables to get
statistics. (This is called DataPilot in OpenOffice.)

If you don't know what Pivot Tables are, the following link will be of

Essentially you can find out:
- How many lines of code have been written per month/week/year? (+ graph)
- Drilldown on lines of code by each developer in any period
- What percentage of code is written on the trunk vs branches?

Python script below. Your newsreader may have wrapped some lines so watch

You will also need to edit the list of extensions. I currently have it so it
filters to only count vb source files. This means I don't count adding a
large binary file as a large dose of productivity! (just change one of these
to .java if you're working on java code).

I tried out other cvs stats tools but they were too top-heavy. I've found
this gives me more flexibility.


Best Regards,

Matthew Herrmann
Far Edge Technology


# Exports stats from cvs in a format which can
# be read by pivottables in excel.
# (C)Copyright Matthew Herrmann, Far Edge Pty Ltd 2004
# Comments : address@hidden
# May be freely used and distributed.

import os
import re

newFile = re.compile("(Working file: )(.*)")
info = re.compile("date: ([^;]+);  author: ([^;]+);  state: Exp;  lines:
\+([^ ]*) -([0-9]*)$")
revision = re.compile("revision ([0-9.]*)")

os.system("cvs log -N > ~tmp.txt")

out = open("table.txt","w+")
f = open("~tmp.txt")
filename = ""
for line in f.readlines():
    if newFile.match(line):
        filename = newFile.match(line).groups(0)[1]
        filename = filename.lower()
        print "Reading " + filename + "..."

    if revision.match(line):
        rev = revision.match(line).groups(0)[0]
        onBranch = rev.count('.') > 1

    # only consider certain files as changes
    if filename:
        if filename.endswith(".bas") or \
            filename.endswith(".cls") or \
            filename.endswith(".frm") or \
            filename.endswith(".ctl") or \
            filename.endswith(".mst") or \
            filename.endswith(".inc") or \
            filename.endswith(".bat") or \
            filename.endswith(".vbs") or \
            filename.endswith(".iss") or \
            filename.endswith(".xsl") or \
            filename.endswith(".js") or \

            if info.match(line):
                data = info.match(line).groups(0)
                out.write(filename + '\t' + data[0] + '\t' + data[1] + '\t'
+ \
                        data[2] + '\t' + data[3] + '\t' + str(int(data[2])+
int(data[3])) + \
                        '\t' + str(int(data[2]) - int(data[3])) + \
                        '\t' + {0:'Trunk',1:'Branch'}[onBranch] + \
                        '\t' + rev + \


-----Original Message-----
Message: 8
Date: Wed, 19 May 2004 12:18:56 +0100
From: Ramanuj Singh <address@hidden>
Subject: reports in CVS
To: "'address@hidden'" <address@hidden>
Message-ID: <address@hidden>
Content-Type: text/plain; charset="us-ascii"

How to generate reports in CVS.

The information transmitted is intended only for the person or entity to
whom it is addressed and may contain confidential and / or privileged
Material. Any review, re-transmission, dissemination or other use of or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from your
computer. Thank you for your understanding & co-operation.

-------------- next part --------------
An HTML attachment was scrubbed...

reply via email to

[Prev in Thread] Current Thread [Next in Thread]