chris blogs

November 2004

27nov2004 · LoC statistics for darcs

Today, I did a nice hack using Darcs to make a Lines of Code statistic.

Darcs provides a command—darcs trackdown—that gets run on every revision of the repository until the given command returns true. Usually, you’d use that to “trackdown” a certain bug by running the testcase on every revision.

However, trackdown also provides a nice way to simply run an command over each revision. I ran this on the darcs repository:

darcs trackdown 'find . -type f -print | xargs wc -l |
      tail -1 | tee -a /tmp/darcsloc; false'

Note the false, so it will always “fail”.

Now twiddle with that data a bit, and you can quite easily get a diagram like:

Lines Of Code of the Darcs repository

(The “vertical lines” are time skews of the Darcs changelog, as patches only have a “record time”, not a “merge time”…)

NP: Neil Young—My My, Hey Hey

Copyright © 2004–2016