After searching for a while, I found only one solutions – svn2cl by Arthur de Jong. It is pretty straight forward, using the xml output of the svn log command and applying a XSL Stylesheet. It supports the standard GNU Changelog text format and a basic html formated one. The tool comes standard as a korn-shell script for Unix only, but luckily there is a windows port by Iwasa Kazmi using csript.
I could have just called the script via a <Exec> task, but this would have been no fun. The script uses the MSBuild Community Extensions.
In addition to just the Changelog I wanted to include
- Creation time
- The Subversion Repository root and revision
- HTML format with revision links back to our trac – changeset browser
- Embed the style sheet, so the generated html file is self sufficient
How to use it
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/> <Import Project="./Build/svn2cl/svn2cl.targets"/> <PropertyGroup> <!-- pick up the workspace repository root or overwrite here --> <!--<Svn2clRepositoryPath> ... </Svn2clRepositoryPath>--> <!-- the marker ## will be replaced with the revision number --> <Svn2clRevisionLink>https://trac-location/trac/project/changeset/##/</Svn2clRevisionLink> <Svn2clLimit>100</Svn2clLimit> <Svn2clChangelogFile>./Changelog.html</Svn2clChangelogFile> <!-- by default take the current workspace revision --> <!--<Svn2clTopRevision>HEAD</Svn2clTopRevision>--> </PropertyGroup> <Target Name="BuildChangeLog" DependsOnTargets="SvnChangeLog"/> </Project>
Repository information
I am using the SvnInfo task from the Community Extensions to determine information about the workspace. <!-- If Svn2clRepositoryPath is not set, get the information from the current working directory -->
<SvnInfo LocalPath="$(MSBuildProjectDirectory)" Condition="$(Svn2clRepositoryPath) == ''">
<Output TaskParameter="RepositoryPath" PropertyName="Svn2clRepositoryPath"/>
<Output TaskParameter="Revision" PropertyName="Svn2clTopRevision"/>
</SvnInfo>
<Error Condition="$(Svn2clRepositoryPath) == ''" Text="Could not determine the Svn2clRepositoryPath"/>
Embed the CSS Style Sheet
I didn’t like the fact that the CSS Style sheet was just referenced, so I changed the XSLT to include it.<!DOCTYPE xsl:stylesheet [
<!ENTITY newl "&#xA;">
<!ENTITY space " ">
<!ENTITY css SYSTEM "svn2html.css">
]>
...
<xsl:template match="log">
<html>
<head>
<title><xsl:value-of select="string($title)" /></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
&css;
</style>
</head>
<body>
Subversion UID’s to real user names with email
The XSL can also read author information from a xml file and include them in the Changelog.<?xml version="1.0" encoding="utf-8"?>
<authors xmlns:html="http://www.w3.org/1999/xhtml">
<author uid="bscholze">
Bernd Scholze <<html:a href="mailto:bscholze@gmail.com">bscholze@gmail.com</html:a>>
</author>
<author uid="nobody">
Who's this <nobody@example.com>
</author>
</authors>
This comment has been removed by the author.
ReplyDeleteI can't download the MSBuild task, please, post again! Thanks
ReplyDeleteUpdated the download link
DeleteThanks!
Delete