SVN - Get all commit messages for a file? SVN - Get all commit messages for a file? shell shell

SVN - Get all commit messages for a file?


svn log filename will show all commit messages associated with filename. The output will look something like the following:

------------------------------------------------------------------------r1206 | kalebp | 2010-03-10 16:48:12 -0800 (Wed, 10 Mar 2010) | 1 lineIntroduce a TranslatorFacade. Make the jar runnable by default.------------------------------------------------------------------------r1085 | kalebp | 2010-03-02 17:10:28 -0800 (Wed, 04 Nov 2009) | 1 lineAnnotation checker now supports complete definitions and named parameters------------------------------------------------------------------------...

If you don't want information prior to a branch or copy there is a --stop-on-copy option that you can add. See svn help log for more information, such as how to specify date ranges, etc.

EDIT:

You can easily grab by a date range using svn log -r{20100101}:{20100331}. I don't like the idea of calling log for changed files, so I'd recommend using the -v flag to get a list of files that changed in the commit.

Here's the process that I would use:

svn log -r{20100101}:{20100331} -v --xml | xsltproc formatter.xsl -

And here's formatter.xsl:

<xsl:stylesheet        xmlns:xsl="http://www.w3.org/1999/XSL/Transform"        xmlns:xsd="http://www.w3.org/2001/XMLSchema"        exclude-result-prefixes="xsd"        version="1.0"        ><xsl:output method="text" indent="no" /><xsl:key name="paths-key" match="/log/logentry/paths" use="path" /><xsl:template match="log/logentry">        <xsl:for-each select="paths/path[count(. | key('paths-key', paths/path)[1]) = 1]">                <xsl:sort select="text()"/>                -- <xsl:value-of select="text()" />                <xsl:for-each select="key('paths-key', .)/preceding-sibling::date">                        <xsl:sort select="translate(text(), '-:.T','')"/>                        <xsl:variable name="selectedDate" select="text()"/>                        <xsl:value-of select="translate($selectedDate, 'T', ' ')"/><xsl:text>                        </xsl:text>                        <xsl:for-each select="following-sibling::msg">                                * <xsl:variable name="msg" select="text()"/>                                <xsl:variable name="date" select="preceding-sibling::date/text()"/>                                <xsl:if test="$selectedDate = $date">                                        <xsl:text>   </xsl:text>                                        <xsl:value-of select="$msg"/>                                </xsl:if>                        </xsl:for-each>                </xsl:for-each>        </xsl:for-each></xsl:template></xsl:stylesheet>


I imagine svn log --xml and some sort of command-line XPath or XSLT is going to be your best bet.


With the command svn log