开发者

How many lines of code modified during a time period?

I have been tasked with figuring out how many lines of code I've written this year. Not very exciting for a number of reasons, but it seems like it could make a nice SO question.

So in your favorite version control tool, how do you tell how many lines of code have been modified? In my particular answer blank lines and comments happen 开发者_如何学编程to count to simplify the time allotted to determining the answer, but feel free to elaborate.

In my particular case I'm using svn, so I'm going to get rid of all the --- and other misc output that svn log and svn diff output.


Use StatSVN. I use it at work and it's great, it'll break down LOC by developer by month. It'll draw pretty graphs, tell you what day of the week and what time you check in the most code. It'll tell you exactly what you need to know.


The simplest solution:

svn diff -x --ignore-eol-style -x -w http://svn/tags/releases/1.0 http://svn/tags/releases/2.0/ |diffstat

this is very rudimentary and does not exclude blank line inserts and so on, but perhaps it's good enough?


Try to use Hits-of-Code metric (which does exactly what you're looking for). You can collect the data using this hoc explained in this blog post: Hits-of-Code Instead of SLoC


Fisheye can tell you how many lines of code were committed per developer. There is a nice charting feature that can give you pretty graphs for this.


I also tried to solve task such as "how many lines were removed, added or just changed in selected period of time". So I wrote simple shell script (for Linux only). It gathers some sipmle statistics about code modifications. More details and shared script you may find here:

http://cyber-fall.blogspot.com/2011/10/tools-linux-svn-generate-statistic.html

Hope it will help to you and to others!


If you are stuck on cvs:

cvs annotate > annotate.txt
rem remove the portion before the name
sed "s/^[0-9. (]*//" annotate.txt > annotate2.txt
rem remove the portion after the name
sed "s/[ ].*$//" annotate2.txt > annotate3.txt
sort annotate3.txt > annotate4.txt
uniq -c annotate4.txt > annotate5.txt

http://jamesjava.blogspot.com/2007/01/who-has-changed-most-lines-in-cvs.html


In Clearcase, take the config spec and add:

time  <date-time>
<rules for choosing branches or labels>
end time

Make a second view, and compare the two. If multiple developers are working on the same files, I have no clue. I can't say I'm thrilled by using Clearcase, ever.


If you are using subversion you can use the svn log command with the --xml switch and you can pull the lines of code from there. You can see the options of svn log using svn help log. Since your output is xml you can run through this xml and aggregate your line counts in code and go from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜