Skip to content

Instantly share code, notes, and snippets.

@mmainguy
Created May 31, 2011 15:45
Show Gist options
  • Save mmainguy/1000720 to your computer and use it in GitHub Desktop.
Save mmainguy/1000720 to your computer and use it in GitHub Desktop.
dump svn commits to a csv file with user, date, comment
require 'rexml/document'
require 'date'
include REXML
start = open("|tail -n1 stats.csv").read
start = start.split(',')[1]
start_date = Date.parse(start).next
file = open("|svn -r {#{start_date}T00:00:00}:HEAD --xml -v log http://some.svn.repo/project")
doc = Document.new(file)
def clean(ele)
if ele
ele.text
else
''
end
end
outfile = File.open("stats.csv","a")
doc.each_element('//logentry') do |entry|
ele = entry.elements
outfile.puts "#{clean(ele['author'])},#{clean(ele['date'])[0..9]},\"#{clean(ele['msg']).gsub("\n","")}\"\n"
end
outfile.close
file.close
@mmainguy
Copy link
Author

This lets you see svn data should you need to run some statistics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment