Is there a simple way to export the subversion logs to a CSV file?
I want to use them to approximate my hours spent on a project and doing so in an spreadsheet would be easy.
Thanks.
Examples. You can see the log messages for all the paths that changed in your working copy by running svn log from the top: $ svn log ------------------------------------------------------------------------ r20 | harry | 2003-01-17 22:56:19 -0600 (Fri, 17 Jan 2003) | 1 line Tweak.
This short Python script will provide a CSV with your SVN log output:
#!/usr/bin/env python
import csv
import subprocess
import sys
import xml.etree.cElementTree as etree
log_text = subprocess.Popen(['svn', 'log', '--xml'] + sys.argv[1:],
stdout=subprocess.PIPE).communicate()[0]
log_xml = etree.XML(log_text)
csv_writer = csv.writer(sys.stdout)
for child in log_xml.getchildren():
csv_writer.writerow([
child.attrib['revision'],
child.findtext('date'),
child.findtext('author').encode('utf-8'),
child.findtext('msg').encode('utf-8'),
])
It passes through command-line arguments to the underlying SVN call, so if you only want to see revision 34 and later, you can invoke it as follows:
$ svnlog2csv -r 34:HEAD >my_spreadsheet.csv
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With