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!)

About this user

Alexander Kellett http://web.mac.com/lypanov

« Newer Snippets
Older Snippets »
1 total  XML / RSS feed 

simple last commits patch statistic for darcs

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

              

            
« Newer Snippets
Older Snippets »
1 total  XML / RSS feed