Irish Buffer
Irish Buffer

Reputation: 872

How can I measure total change in codebase (Eclipse and Mercurial)

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:

Then we can compute things such as the percentage change = D/V2

Any recommendations for tools that can do this?

Upvotes: 4

Views: 1325

Answers (3)

Josh H. Galorath
Josh H. Galorath

Reputation: 21

Yes, ProjectCodeMeter can give you differential sloc between 2 versions of source code, but better than that, it can also give you the difference in development time (which is what i guess you want to really aim for).

Upvotes: 0

Irish Buffer
Irish Buffer

Reputation: 872

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.

Upvotes: 1

krtek
krtek

Reputation: 26597

hg log --stat will show you various stats for each commit, including inserted / deleted lines.

I don't know if there's a better solution, but you can parse theses results to achieve what you want.

You can also have a look at this previous answer on SO : Counting changed lines of code over time

Upvotes: 3

Related Questions