We need to be able to compute the total change in lines of code between two versions (V1 and V2) of a large Java codebase. A tool that uses either Eclipse or Mercurial would be ideal.
Counting the number of lines of code in V1 and V2 is not sufficient, since some sections of code will have been removed and rewritten between versions.
What we really need is to compute something like:
- I = Intersection of V1 and V2
- D = Difference from I to V2
Then we can compute things such as the percentage change = D/V2
Any recommendations for tools that can do this?
After trying some approaches based on Hg, I found that the best solution is to use CLOC (Count Lines of Code): http://cloc.sourceforge.net/
You can give it two folders containing two versions of a project, and it will count all of the lines that are the same, modified, added, removed. It’s exactly what I needed.