darcs is a version control system, such as svn, git, mercurial, … while its losing the popularity match against pretty much all other vcs’s it’s still used where I work. I’m not a huge fan, but that’s beside the point. For reporting matter (eg. bosses) its nice to show a fancy graph, that productivity is growing over the years. Hence I find myself in need of getting historical data from darcs, darcs unlike the other vcs’s don’t have allot of nice fancy tools for pulling graphs. So here I’d like to share some shell “hacks” to get them.


Getting commits for each year :

for VARIABLE in {2000..2016}; do 
darcs changes --xml-output | grep "<patch"  | grep "date='$VARIABLE" | grep eter | wc -l; 
done

Getting commits¬†for a single person for each year, in this case “tom”, note that names of authors might change : Tom, tom, lastnameT, …

for VARIABLE in {2000..2016}; do 
darcs changes --xml-output | grep "<patch"  | grep "date='$VARIABLE" | grep tom | wc -l; 
done

Getting all Lines of code over patches. (#patch 1 : 100, #patch 2 : 105, …) (source)
note : cat /tmp/darcslog will contain a list from last patch to first patch with the lines of code.

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

Show all authors :

darcs show authors

Show repo info (including #of patches)

darcs show repo

 

Know any other hacks/scripts for darcs, feel free to share!