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 https://server.org/svn/project
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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <h2>SVN Log</h2> <table border="1"> <xsl:for-each select="log/logentry"> <xsl:if test="author='USERNAME'"> <tr> <td><xsl:value-of select="date"/></td> <td><xsl:value-of select="author"/></td> <td><xsl:value-of select="msg"/></td> </tr> </xsl:if> </xsl:for-each> </table> </body> </html> </xsl:template> </xsl:stylesheet>
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 https://server.org/svn/project | 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.
| Print article | This entry was posted by joachim on 20. November 2010 at 14:27, and is filed under Development, Mac OS X. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 5 months ago
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.
about 5 months ago
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.