Most SVN users who use the command line client understand how to create a log in XML format:
svn log --xml -v svn://some/url > svnlog.xml
But this dumps the whole log, and I really just want to see a specific user. Plus, I hate XML and definitely do not want to read it.
Here is a handy stylesheet:
<?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>Header</h2>
<table border="1">
<xsl:for-each select="log/logentry">
<xsl:if test="author='YOUR_NAME_HERE'">
<tr>
<td><xsl:value-of
select="@revision"/></td>
<td><xsl:value-of
select="author"/></td>
<td><xsl:value-of
select="date"/></td>
<td><xsl:value-of
select="msg"/></td>
</tr>
<xsl:for-each select="paths/path">
<tr>
<td></td>
<td><xsl:value-of
select="@action"/></td>
<td><xsl:value-of
select="."/></td>
</tr>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Simply add a header line to your output log, like this:
<?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="mystylesheet.xsl"?> <log> <logentry revision="6610">
Add the username you wish to filter on in the stylesheet (in place of YOUR_NAME_HERE), and open the log file in the browser.
Hat tip to:
Subversion Users mailing list
w3schools how to use xslt
8 Comments
YOU ARE
!!A W E S O M E!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
thanks for a cool style sheet!
Nice idea. But its not working for me. after generating the xml output and placed the line in the xml ‘. I did not get the desired out put.
what I am doing wrong?
Ok. Take that back. it works fine…!! thanks.
Quick format upgrade:
after
Revision#
Authortd>
Change path
Log Message
Then……
Set the td with for the respective values
Example:
and so on…..
Quick format upgrade:
after table border =1
tr
td width=”80″ bgcolor=”" bordercolor=”" bordercolorlight=”" bordercolordark=”"Revision#/td
td width=”80″ bgcolor=”" bordercolor=”" bordercolorlight=”" bordercolordark=”"Author/td
td width=”963″ bgcolor=”" bordercolor=”" bordercolorlight=”" bordercolordark=”"Change path/td
td width=”200″ bgcolor=”" bordercolor=”" bordercolorlight=”" bordercolordark=”"Log Message/td
/tr
Then……
Set the td with for the respective values
Example:
td width=”80″xsl:value-of select=@revision//td
and so on…..
Glad that worked out for you GEDZ, thanks for the format upgrade tip.
How about generating some statistics on top, like total number of commits of specific user, commits per month by specific user and commits by specific user in comparison to total amount of commits made?
Who can contribute?
Sounds like a good idea Mr X.
I haven’t committed this to a repo anywhere. Feel free to take what I’ve posted and run with it.
If you commit it to github or some other place, please consider posting a link via comment here.
Post a Comment