Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Subversion report the percentage of code changed over time?

Tags:

scripting

svn

I would like to know on a line by line basis, what percentage of source code within a subversion repository has been modified between two commits.

For example. say revision 2100 has 150,000 lines of code -- but revision 2600 has 165,000 lines of code where 8,000 lines of the original 150,000 code where modified. I would report this as 142,000 / 165,000 = 86% the same, 14% "new". I don't care to separate Javadoc, XML, comments, or unit tests....just lump them all together as "source".

Any idea how to do this?

like image 342
HDave Avatar asked Jun 21 '10 15:06

HDave


1 Answers

I just did this today using the free open-source tool CLOC. It allows you to compare two directories recursively, so all you need to do is have both versions checked out and run the program on it.

It also gives summaries for separate languages and total, for example:

Language                      files          blank        comment           code
--------------------------------------------------------------------------------
SUM:
 same                          1556              0          76662         165546
 modified                       137              0            159            570
 added                            2            241            257           1250
 removed                         30            591            906           2271

As you can see from the 'blank' statistic there, it's not perfect, but it definitely gives you a ballpark.

like image 190
Bringer128 Avatar answered Oct 31 '22 19:10

Bringer128