Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] who wrote the most code?


On Tue, 2004-02-24 at 14:06, Jamie Wilkinson wrote:
> A few weeks ago, Benno asked me if I had a way to use cvs annotate to
> work out percentages of code written, and after a short bit of hacking,
> there was this:
> 
> a=; t=0; cvs ann 2>/dev/null | cut -c15-21 | sort | uniq -c | while read i; do u=`echo $i | cut -f2 -d' '`; s=`echo $i | cut -f1 -d' '`; t=$((${t-0} + $s)); echo $t $u $s ; done | sort -rn | while read i ; do if [ "x$a" = "x" ]; then a=`echo $i | cut -f1 -d' '`; fi ; u=`echo $i | cut -f2 -d' '`; s=`echo $i | cut -f3 -d' '`; s=$(($s * 100)); echo $u $(($s / $a)); done
> 
> but I was looking at the subversion repo at work today, and wondered
> the same thing... so with a bit of mangling here it is:
> 
> a=; t=0; find . -type f ! -regex '.*\.svn.*' -exec svn ann {} \; 2>/dev/null | awk '{print $2}' | sort | uniq -c | while read i; do u=`echo $i | cut -f2 -d' '`; s=`echo $i | cut -f1 -d' '`; t=$((${t-0} + $s)); echo $t $u $s ; done | sort -rn | while read i ; do if [ "x$a" = "x" ]; then a=`echo $i | cut -f1 -d' '`; fi ; u=`echo $i | cut -f2 -d' '`; s=`echo $i | cut -f3 -d' '`; s=$(($s * 100)); echo $u $(($s / $a)); done
> 
> Fun, eh? :-)

Pity it's completely wrong.

How? Thats an exercise for the reader. Hint: your script does what you
intended it to do, but the result is /not/ LOC per person.

Rob
-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.

Attachment: signature.asc
Description: This is a digitally signed message part