Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

simple last commits patch statistic for darcs (See related posts)

./thisscript.rb 10
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}"

          

        

You need to create an account or log in to post comments to this site.


Related Posts