[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Fwd: svn Line Count metrics, counting line changes

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: 2006-03-28 05:58:01 CEST

Fred Trotter wrote:
> Tried this on users... but it is appropriate here too.
>
> Hello,
> My googling the subject has turned up many requests for this
> type of script, but no solutions. I am interested in performing an
> analysis on the number of lines of code that are modified in a svn
> repository over time. To do this I simply need a way to see how many
> lines of code are in each revision number.

[...]

> There are dicussions in the past on this list which talk about there
> being no easy way to do this, or using multiple calls to svn diff to get
> the answer. Perhaps multiple calls to svn diff using a special diff
> syntax piped to wc?
>
> If no one has a solution to this problem then I intend to create one. So
> any advice to that end is helpful. I recognize, from previous posts,
> that svn internals are not designed to provide this, so I am not looking
> to create a "real time" tool. I will be satisfied with a "runs all night
> but gets the right answer" type script.
>
> Please advise,

The svndbadmin tool that comes with ViewVC (and is used for populating a
Bonsai-like database of commit metadata) performs calculations of this sort
by running 'diff' on each modified file in a revision (against its prior
state), grepping for the line-count headers in that diff output, and doing
arithmetic stuffs with it. This tool is written to be run as a post-commit
tool, at which time it populates the Bonsai-ish database with the info that
one recent commit.

Here's a link to the ViewVC view of that tool's source code:
http://viewvc.tigris.org/source/browse/viewvc/trunk/bin/svndbadmin?rev=1288&view=markup

-- 
C. Michael Pilato <cmpilato@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on Tue Mar 28 06:02:46 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.