2011-10-11 21 views
1

如果SVN url已经存在,我需要失败。基本上我停止从发布的代码进一步构建。在ANT我会跑 南特svnExists的等效

<if> 
     <svnExists target="svn url" refid="svn.settings"/> 
     <then> 
      <fail>Can not give this build to QA - this number was already released to Operations</fail> 
     </then> 
     <else> 
      <echo message="good to go"/> 
     </else> 
    </if> 

但我找不到这样的NANT,我需要使用这个项目的等效方式。想法?

回答

3

你可以用svn程序和exec任务来做到这一点。

<exec program="svn" resultproperty="zero_if_url_exists.prop" failonerror="false"> 
    <arg value="info"/> 
    <arg value="http://my.svn.server/branches/foobar"/> 
</exec> 

<if test="${int::parse(zero_if_url_exists.prop) == 0}"> 
    <echo message="The url exists."/> 
</if> 
<if test="${int::parse(zero_if_url_exists.prop) != 0}"> 
    <echo message="The url doesn't exist."/> 
</if>