Exporting SVN Change Log in Phing
Posted: Jul 17, 2010
Last night I was working on add a phpDocumentor task to a Phing build script I have been working on. While Phing offers integration with phpDocumentor as well as some SVN task such as commuting, updating, and exporting, it doesn't have a native way to export the change log which I would like to include in the documentation. However, one great feature of Phing is how easy it is to expand. I wrote this little ad-hoc task to export the SVN history to a file which I then include in the documentation.
Here is the code if you'd like to add it to your build scripts:
Here is how you call it:
Here is the code if you'd like to add it to your build scripts:
<adhoc-task name="svnlog">
<!--[CDATA[
class svnLog extends Task {
private $file;
private $svnpath;
private $repositoryurl;
function setFile($file) {
$this->file = $file;
}
function setSvnPath($svnpath) {
$this->svnpath = $svnpath;
}
function setRepositoryUrl($repositoryurl) {
$this->repositoryurl = $repositoryurl;
}
private function writeSvnLog($svnpath="/usr/bin/svn", $repositoryurl, $file){
$cmd = $svnpath . " log " . $repositoryurl . " > " . $file;
echo $cmd . "\n";
system($cmd);
return true;
}
function main() {
$this->writeSvnLog($svnpath = $this->svnpath, $repositoryurl = $this->repositoryurl, $file = $this->file);
}
}
]]-->
</adhoc-task>
Here is how you call it:
<svnlog svnpath="/usr/bin/svn" repositoryurl="http://rex/svn/${package}/" file="${workingDir}/CHANGELOG"></svnlog>