You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Fred Trotter <fr...@gmail.com> on 2006/03/27 17:17:16 UTC

svn Line Count metrics, counting line changes

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. I would like to have a simple csv, (or xml) file that
states at least. Something like this.

Rev, LOC added/changed
1, 200
2, 10
3, 40
...
n, 100

It would be great if I could get something like
Rev, file, lines added/changed
1, my_phpfile.php, 20
1, my_java_file.java, 2
1, my_other_file, 10

or something like that. I have searched for this and only discovered
questions like...
http://www.svnforum.org/2017/viewtopic.php?t=626

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,
--
Fred Trotter
SynSeer, Consultant
http://www.fredtrotter.com
http://www.synseer.com

Re: svn Line Count metrics, counting line changes

Posted by Andy Levy <an...@gmail.com>.
On 3/28/06, Ryan Schmidt <su...@ryandesign.com> wrote:
> On Mar 27, 2006, at 19:17, Fred Trotter wrote:
>
> >          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. [snip!]  So any advice to
> > that end is helpful. [snip!]
>
> I can only give you the following advice:
>
> http://www.folklore.org/StoryView.py?
> project=Macintosh&story=Negative_2000_Lines_Of_Code.txt

I had a project manager once who attempted to manage project progress
by line count instead of feature-completeness and outstanding bug
count.  We didn't get along so well. :)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: svn Line Count metrics, counting line changes

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Mar 27, 2006, at 19:17, Fred Trotter wrote:

>          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. [snip!]  So any advice to  
> that end is helpful. [snip!]

I can only give you the following advice:

http://www.folklore.org/StoryView.py? 
project=Macintosh&story=Negative_2000_Lines_Of_Code.txt

:-)



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

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

Posted by Mattias EngdegÄrd <ma...@virtutech.se>.
"Fred Trotter" <fr...@gmail.com> writes:

>I wanted to let everyone know the end result of this little quest. The
>script from ViewVC worked perfectly, and with SVK as well as SVN. That mean=
>s
>that I was able to import projects from SVN and CVS and then use ViewVC to
>generate stats for all of them.

That is good to hear. I needed the +- line counts in order to show them in
a revision log browser, so I calculated them from the output of svn diff.
Removed directories don't show up (issue 2524), so I had to cat them
recursively in order to count the lines that were removed. This takes some
time, but is only run once (as a post-commit script), and saved in a
revision property.

If anyone wants my script, send me a mail. It does not need direct
repository access, in contrast to the ViewVC script (unless I misread it
entirely).


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by "C. Michael Pilato" <cm...@collab.net>.
[Forwarding to dev@viewvc.tigris.org so that group is aware of your work.]

Fred Trotter wrote:
> 
> I wanted to let everyone know the end result of this little quest. The
> script from ViewVC worked perfectly, and with SVK as well as SVN. That
> means that I was able to import projects from SVN and CVS and then use
> ViewVC to generate stats for all of them.
> 
> I wrote several PHP scripts that generate graphs and statistics from the
> ViewVC data. I will release these under the GPL for whomever would like
> them, but ultimately I think that it would be more lucid if they were
> recoded in python and merged with the ViewVC project. Still you can
> download the code and read the how-to by going to...
> 
> http://ehr.gplmedicine.org
> 
> and looking under "review tools"...
> 
> Thanks for the help
> 
> 
>     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
>     <http://viewvc.tigris.org/source/browse/viewvc/trunk/bin/svndbadmin?rev=1288&view=markup>
> 
>     --
>     C. Michael Pilato <cmpilato@collab.net <ma...@collab.net>>
>     CollabNet   <>   www.collab.net <http://www.collab.net>   <>  
>     Distributed Development On Demand
> 
> 
> 
> 
> 
> -- 
> Fred Trotter
> SynSeer, Consultant
> http://www.fredtrotter.com
> http://www.synseer.com


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

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by Fred Trotter <fr...@gmail.com>.
I wanted to let everyone know the end result of this little quest. The
script from ViewVC worked perfectly, and with SVK as well as SVN. That means
that I was able to import projects from SVN and CVS and then use ViewVC to
generate stats for all of them.

I wrote several PHP scripts that generate graphs and statistics from the
ViewVC data. I will release these under the GPL for whomever would like
them, but ultimately I think that it would be more lucid if they were
recoded in python and merged with the ViewVC project. Still you can download
the code and read the how-to by going to...

http://ehr.gplmedicine.org

and looking under "review tools"...

Thanks for the help


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 <cm...@collab.net>
> CollabNet   <>   www.collab.net   <>   Distributed Development On Demand
>
>
>


--
Fred Trotter
SynSeer, Consultant
http://www.fredtrotter.com
http://www.synseer.com

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

Posted by Marc Sherman <ms...@projectile.ca>.
C. Michael Pilato wrote:
> 
> They are not (yet).  I do have them enabled on svn.collab.net, though.  (See
> the "query revision history" link on one of the directory views.)

That's pretty cool, thanks for the link.

- Marc

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by "C. Michael Pilato" <cm...@collab.net>.
Marc Sherman wrote:
> C. Michael Pilato wrote:
> 
>>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.
> 
> 
> This is getting OT, please let me know if I should take it off-list.
> 
> Are the Bonsai-like features enabled on the tigris.org or server?  If
> so, how does one access them?

They are not (yet).  I do have them enabled on svn.collab.net, though.  (See
the "query revision history" link on one of the directory views.)


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

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

Posted by Marc Sherman <ms...@projectile.ca>.
C. Michael Pilato wrote:
> 
> 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.

This is getting OT, please let me know if I should take it off-list.

Are the Bonsai-like features enabled on the tigris.org or server?  If
so, how does one access them?

- Marc


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

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

Posted by "C. Michael Pilato" <cm...@collab.net>.
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 <cm...@collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Fwd: svn Line Count metrics, counting line changes

Posted by Fred Trotter <fr...@gmail.com>.
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. I would like to have a simple csv, (or xml) file that
states at least. Something like this.

Rev, LOC added/changed
1, 200
2, 10
3, 40
...
n, 100

It would be great if I could get something like
Rev, file, lines added/changed
1, my_phpfile.php, 20
1, my_java_file.java, 2
1, my_other_file, 10

or something like that. I have searched for this and only discovered
questions like...
http://www.svnforum.org/2017/viewtopic.php?t=626

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,
--
Fred Trotter
SynSeer, Consultant
http://www.fredtrotter.com
http://www.synseer.com