2011-10-11 25 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>