Ticket #195 (closed defect: fixed)

Opened 1 year ago

Last modified 9 months ago

SvnLastRevisionTask fails if Subversion is localized (Spanish)

Reported by: penyaskito Assigned to: arnoschn
Priority: major Milestone: 2.3.1
Component: phing-tasks-ext Version: 2.3.0
Keywords: Cc:

Description

SvnLastRevisionTask fails if Subversion is localized, at least in Spanish. The output of svn info is:

Revisión: 10

but Phing expects to be:

Rev: 10

Attachments

Change History

12/08/07 23:25:54 changed by penyaskito

Sorry, the line from svn status that we want is the last changed revisión in the current dir, so respectively:

Last Changed Rev: 10
Revisión del último cambio: 10

12/09/07 12:22:25 changed by penyaskito

This wasn't as easy as I thought because of the unicode characters (ó) in the output. RegExps seems to not work fine with Unicode characters, after testing with:

/Rev[.*]?/u'

Revisión doesn't match.

After searching a lot, the easiest way is removing that characters before the regexp. If anyone has not a better solution, I'll do this way. Anyway, this should be problematic with more languages.

12/09/07 13:18:26 changed by mrook

  • status changed from new to closed.
  • resolution set to wontfix.

I don't think we really want to adapt Phing to the large number of languages SVN supports, closing for now.

01/04/08 15:55:49 changed by arnoschn

Hi guys,

I have a fix for the localization problem, since we came across the same problem in Xinc:

SvnLastRevisionTask.php

....

function main()
	{
		$this->setup('info');
		
		/**
		 * run in xml mode, allows us to retrieve workingcopy info in 
		 * a unified xml format, so we dont have to fight with internationalized
		 * versions of svn info output
		 */
		$output = $this->run(array('--xml'));
		try 
		{
			$xml = new SimpleXMLElement($output);
			/**
			 * walk the xml towards the last commit element
			 */
			$commits = $xml->xpath('/info/entry/commit');
			if (count($commits)>0) {
				$commit = $commits[0];
				/**
				 * get the attributes of the commit element
				 */
				$attributes = $commit->attributes();
				$this->project->setProperty($this->getPropertyName(), $attributes->revision);
			} else {
				throw new BuildException("Failed to parse the output of 'svn info'.");
			}
			
		}
		catch (Exception $e)
		{
			throw new BuildException("Failed to parse the output of 'svn info'.");
		}
	}
....

If you agree I can commit the change into the trunk. Dont know if its interesting to apply the patch to older versions?

Arno

01/04/08 16:11:31 changed by arnoschn

  • status changed from closed to reopened.
  • resolution deleted.

01/04/08 16:11:36 changed by arnoschn

  • owner changed from hans to arnoschn.
  • status changed from reopened to new.

01/04/08 16:13:27 changed by arnoschn

(In [335]) Refs #195: switching to parse xml output from svn info (svn info --xml). more reliable than any localized string output.

01/04/08 16:13:28 changed by arnoschn

(In [335]) Refs #195: switching to parse xml output from svn info (svn info --xml). more reliable than any localized string output.

01/04/08 16:15:03 changed by arnoschn

  • status changed from new to closed.
  • resolution set to fixed.

Add/Change #195 (SvnLastRevisionTask fails if Subversion is localized (Spanish))




Action