simple last commits patch statistic for darcs
will add up the patch stats for the last 10 commits
to the current darcs repo. this differs from the results
for a simple `diff -u --last` as this is the minimal patch
set whereas the script below stats the "edits patch"
#!/usr/bin/ruby
hashes=[]
changelist=`darcs changes --last #{ARGV.first} --xml`
changelist.each_line {
|line|
next unless line =~ /hash='(.*?).gz'/
hashes << $1
}
added, removed = 0, 0
hashes.each {
|hash|
diff=`darcs annotate --match "hash #{hash}"`
diff.each_line {
|l|
added += 1 if l =~ /^[-]/
removed += 1 if l =~ /^[+]/
}
}
puts "+#{added} -#{removed}"