- Timestamp:
- 01/04/08 16:13:27 (6 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/classes/phing/tasks/ext/svn/SvnLastRevisionTask.php
r309 r335 27 27 * 28 28 * @author Michiel Rook <michiel.rook@gmail.com> 29 * @author Arno Schneider <arnoschn@gmail.com> 29 30 * @version $Id$ 30 31 * @package phing.tasks.ext.svn … … 61 62 $this->setup('info'); 62 63 63 $output = $this->run(); 64 65 if (preg_match('/Rev:[\s]+([\d]+)/', $output, $matches)) 64 /** 65 * run in xml mode, allows us to retrieve workingcopy info in 66 * a unified xml format, so we dont have to fight with internationalized 67 * versions of svn info output 68 */ 69 $output = $this->run(array('--xml')); 70 try 66 71 { 67 $this->project->setProperty($this->getPropertyName(), $matches[1]); 72 $xml = new SimpleXMLElement($output); 73 /** 74 * walk the xml towards the last commit element 75 */ 76 $commits = $xml->xpath('/info/entry/commit'); 77 if (count($commits)>0) { 78 $commit = $commits[0]; 79 /** 80 * get the attributes of the commit element 81 */ 82 $attributes = $commit->attributes(); 83 $this->project->setProperty($this->getPropertyName(), $attributes->revision); 84 } else { 85 throw new BuildException("Failed to parse the output of 'svn info'."); 86 } 87 68 88 } 69 else89 catch (Exception $e) 70 90 { 71 91 throw new BuildException("Failed to parse the output of 'svn info'.");
