Helper script "count_r2lines" (counts total and original lines for a particular path and revision):
--8<-- #!/bin/sh
if [ "$#" != 2 ]; then echo >&2 "Usage: $0 dir rev" exit 1 fi
dir="$1" rev="$2"
repos="file://"$HOME"/repos/Pike/"
hit=0 tot=0 svn ls -r"$rev" -R "$repos"Pike/"$dir"@"$rev" | sed -e '//$/d' | while read f; do set `svn annotate -r"$rev" "$repos"Pike/"$dir"/"$f"@"$rev" | sed -e 's/^ *([0-9]*) *.*$/\1/' | /usr/xpg4/bin/awk 'BEGIN {x=0} $1=="2" { x++ } END {print x,NR}'` hit=`expr $hit + $1` tot=`expr $tot + $2` echo "$hit" "$tot" done | tail -1 --8<--
Main script (runs the helper script for each pike branch at head, and for the original ulpc checkin):
--8<-- #!/bin/sh
doit() { dir="$1" rev="$2" name="$3" set `./count_r2lines "$dir" "$rev"` echo "$name" "$1" "$2" }
for i in 7.8 7.6 7.4 7.2 7.0 0.6 0.5 ulpc ulpc.old; do doit $i head $i done doit ulpc 2 ulpc.0 --8<--
Pike script for presentation of the raw data generated by the main script:
--8<-- #!/home/marcus/bin/pike
int lcnt0;
int main() { array(string) x = Stdio.read_file("r2lines.data")/"\n"-({""}); sscanf(x[-1], "%*s %*d %d", lcnt0); foreach(x, string y) { string n; int l, t; sscanf(y, "%s %d %d", n, l, t); write("%-8s %5d / %6d %5.1f%% %5.1f%%\n", n, l, t, 100.0*l/t, 100.0*l/lcnt0); } return 0; } --8<--
I ran this on eureka-svn, but if you change the assignment of "repos" to "http://eureka-svn.lysator.liu.se/" it should run anywhere.