You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by mindspin311 <co...@gmail.com> on 2008/04/18 18:02:22 UTC

extracting revision number using ant-contrib regexp

I'm using ant-contrib's propertyregex task to try to extract a revision
number from the repository without making any changes to a sandbox, so svn
up is no good...

I'm using this for the regexp attribute to parse the output of svn info:

regexp="Path: ([^\.]*)\n                                                                                                            
     URL: ([^\.]*)\n                                                                                                                
     Repository Root: ([^\.]*)\n                                                                                                    
     Repository UUID: ([^\.]*)\n                                                                                                    
     Revision: ([^\.]*)\n                                                                                                           
     Node Kind: ([^\.]*)\n                                                                                                          
     Last Changed Author: ([^\.]*)\n                                                                                                
     Last Changed Rev: ([^\.]*)\n                                                                                                   
     Last Changed Date: ([^\.]*)\n"

now just doing select="\5" should get the revision number but all I get
returned is "${rev}" the name of the  property I am storing it in, not the
value.

Is my regexp wrong?
-- 
View this message in context: http://www.nabble.com/extracting-revision-number-using-ant-contrib-regexp-tp16763539p16763539.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


AW: extracting revision number using ant-contrib regexp

Posted by Ja...@rzf.fin-nrw.de.
I think that would be easier:
- Let SVN create the output in xml format
- Read that infos


Jan


<project>

  <!-- Path to a directory under SVN-control -->
  <property name="project.dir" value="../../svn-repository/ant/core"/>
  
  <!-- temporary file -->
  <property name="tmp.file" value="svn.info.xml"/>
  
  <!-- Use 'svn info' output all information, but in XML -->
  <exec executable="svn" dir="${project.dir}" output="${tmp.file}">
      <arg value="info"/>
      <arg value="--xml"/>
  </exec>
  
  <!-- Read the information directly from xml -->
  <xmlproperty file="${tmp.file}" prefix="svn"/>
  
  <!-- Delete the temp file -->
  <delete file="${tmp.file}"/>
  
  <!-- Print some infos -->
  <echo>
       Revision      ${svn.info.entry(revision)}
       Last author   ${svn.info.entry.commit.author}
       Last commit   ${svn.info.entry.commit.date}
  </echo>
  <!-- or print all infos
  <echoproperties prefix="svn."/>
  -->

</project> 

> -----Ursprüngliche Nachricht-----
> Von: mindspin311 [mailto:connoc.mindspin@gmail.com] 
> Gesendet: Freitag, 18. April 2008 18:02
> An: user@ant.apache.org
> Betreff: extracting revision number using ant-contrib regexp
> 
> 
> I'm using ant-contrib's propertyregex task to try to extract 
> a revision
> number from the repository without making any changes to a 
> sandbox, so svn
> up is no good...
> 
> I'm using this for the regexp attribute to parse the output 
> of svn info:
> 
> regexp="Path: ([^\.]*)\n                                      
>                                                                       
>      URL: ([^\.]*)\n                                          
>                                                                       
>      Repository Root: ([^\.]*)\n                              
>                                                                       
>      Repository UUID: ([^\.]*)\n                              
>                                                                       
>      Revision: ([^\.]*)\n                                     
>                                                                       
>      Node Kind: ([^\.]*)\n                                    
>                                                                       
>      Last Changed Author: ([^\.]*)\n                          
>                                                                       
>      Last Changed Rev: ([^\.]*)\n                             
>                                                                       
>      Last Changed Date: ([^\.]*)\n"
> 
> now just doing select="\5" should get the revision number but 
> all I get
> returned is "${rev}" the name of the  property I am storing 
> it in, not the
> value.
> 
> Is my regexp wrong?
> -- 
> View this message in context: 
> http://www.nabble.com/extracting-revision-number-using-ant-con
trib-regexp-tp16763539p16763539.html
> Sent from the Ant - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org