I need to get the SVN revision number of individual files (to build a querystring for the links to my JavaScript files in order to force reloading in the browser cache).
When setting the following:
<svnlastrevision workingcopy="${project.basedir}/${js_a}/${js_a_sub}/${js_a_proto}" propertyname="svn.rev_a_prototype"/>
The following exception is generated:
[svnlastrevision] c:\php\PEAR\simple.xml:19:42: '<path>/js/prototype.js' is not a directory
[Exception in XML parsing]
exception 'BuildException' with message 'c:\php\PEAR\simple.xml:19:42: '<path>/js/prototype.js' is not a directory' in C:\php
\PEAR\pear\phing\tasks\ext\svn\SvnBaseTask.php:261
Stack trace:
#0 C:\php\PEAR\pear\phing\tasks\ext\svn\SvnLastRevisionTask.php(61): SvnBaseTask
->setup('info')
#1 C:\php\PEAR\pear\phing\Task.php(254): SvnLastRevisionTask->main()
#2 C:\php\PEAR\pear\phing\parser\TaskHandler.php(188): Task->perform()
#3 C:\php\PEAR\pear\phing\parser\AbstractHandler.php(80): TaskHandler->finished(
)
#4 C:\php\PEAR\pear\phing\parser\AbstractSAXParser.php(102): AbstractHandler->en
dElement('svnlastrevision')
#5 [internal function]: AbstractSAXParser->endElement(Resource id #504, 'svnlast
revision')
#6 C:\php\PEAR\pear\phing\parser\ExpatParser.php(129): xml_parse(Resource id #50
4, '<project name="...', 1)
#7 C:\php\PEAR\pear\phing\parser\ProjectConfigurator.php(91): ExpatParser->parse
()
#8 C:\php\PEAR\pear\phing\parser\ProjectConfigurator.php(58): ProjectConfigurato
r->parse()
#9 C:\php\PEAR\pear\phing\Phing.php(499): ProjectConfigurator::configureProject(
Object(Project), Object(PhingFile))
#10 C:\php\PEAR\pear\phing\Phing.php(164): Phing->runBuild()
#11 C:\php\PEAR\pear\phing\Phing.php(262): Phing::start(Array, NULL)
#12 C:\php\PEAR\pear\phing.php(41): Phing::fire(Array)
#13 {main}
The reason is SvnBaseTask checking that the workingCopy is a directory, which can be considered fair enough for update or commit, but too restrictive for info.
The attached patch enables checking that the workingCopy is a file, if it is not a directory and the mode is info.