Search code examples
svnantcontinuous-integrationnant

Equivalent of svnExists in NANT


I need to fail a nant build if an SVN url already exists. Essentially I am stopping further builds from released code. In ANT I would run

    <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>

But I can't find an equivalent way of doing this for NANT, which I need to use for this project. Ideas?


Solution

  • You can do it with the svn program and the exec task.

    <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>