Generate readable log from svn repository

If you want to see, what you have already done for a certain project of your repository, SVN offers you the ability to export the log as a XML-File.

svn log -v --xml

This will show the log directly in your console. If you prefer the output as a file append

> outfile.xml

If you’d like to have a more human readable output, you can use the following xsl, to transform it to a readable html table:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
<xsl:template match="/">
<h2>SVN Log</h2>
<table border="1">
<xsl:for-each select="log/logentry">
<xsl:if test="author='USERNAME'">
<td><xsl:value-of select="date"/></td>
<td><xsl:value-of select="author"/></td>
<td><xsl:value-of select="msg"/></td>

Change USERNAME to your svn username and save it to svnstyle.xsl for example.

Now you can use the following command to export and transform the export-xml directly to readable html via:

svn log -v --xml | xsltproc svnstyle.xsl - > ~/Desktop/svnlog.html

This uses the XSLT-Processor xsltproc, which seams to be preinstalled on a Mac OS X system. But you can replace it with any XSLT-Processor of your choice 😉

The svn command may require username and password – so you may get asked for turing the process.
You can specify a username and password with the parameters –username USERNAME and –password PASSWORD.
But think of the little security issue.

2 comments » Write a comment

  1. Nice stylesheet but buggy…
    Please check your code view plugin on your blog. Copy to clipboard copies some missing stuff from the plain view…
    The closing tags of template and stylesheet are missing at all.
    May some comments on the user if condition. Me and may some others don’t need it and get confused why html output is empty because of e.g. user name diffs from svn user name.

    • Thanks for your note. Fixed the stylesheet. The Syntax Highlighting Plugin seams to be buggy you’re right. For compatibility reason I will stick to that WordPress Plugin anyway.

Leave a Reply

Required fields are marked *.

This site uses Akismet to reduce spam. Learn how your comment data is processed.