Search this site


Metadata

Articles

Projects

Presentations

Watching yourself work

I got bored and wanted to see how many lines of code I had otherwise altered since winter break started.

The actual numbers are:

  • Added: 1617
  • Deleted: 1964
I've deleted a lot more than I have added. This is reasonable considering I've been doing quite a bit of code refactoring and I always end up with smaller code that does more.

I'm sure the method I used wasn't the cleanest or best method to go about finding these numbers, but I wasn't looking to spend more than 5 minutes figuring it out. Here's how I looked those numbers up:

% p4 diff -ds `find ./ | sed -e 's,$,@2005/12/20,'` > changes
% awk 'BEGIN { add = 0; del = 0; chg = 0 }; 
/^add/ { add += $4 }; 
/^deleted/ { del += $4 }; 
/^changed/ { chg += $4 }; 
END { printf "Add/Del/Chg: %d/%d/%d", add, del, chg}' changes

Add/Del/Chg: 326/10/139

% svn diff -r {2005-12-20}:head > diffs
% awk 'BEGIN {add = 0; del = 0}
/^-[^-]/ { add += 1};
/^+[^+]/ { del += 1 };
END { print add" "del}' diffs

1152 1815