相当于NANT中的svnExists

时间:2011-10-11 18:38:48

标签: svn ant continuous-integration nant

如果SVN网址已经存在,我需要在nant构建时失败。基本上我停止从已发布的代码进一步构建。在ANT我会跑           

    <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做同样的方法,我需要为这个项目使用它。想法?

1 个答案:

答案 0 :(得分: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>
相关问题