Automate SVN Adds Using NAnt

build-automationnantsvn

I want to automate SVN adds using NAnt. I want to add to SVN all new files in a given directory. The NAnt script will successfully execute the add command, however it displays the Tortoise SVN add dialog and this is not acceptable because it will execute on a build server running CruiseControl. The build server is running Windows Server 2003.

Any ideas?

<target name="addtest">
    <exec program="c:\program files\tortoisesvn\bin\tortoiseproc.exe" 
        commandline="/command:add * --force /path:C:\svn\test /notempfile /closeonend:1"
        basedir="C:\svn\test"
        failonerror="false"/>
</target>

Best Answer

Instead of using the exec task, there is a svn task which is provided by the NAntContrib set of tasks/tools.

<svn command="add" ... />

Of course doing this probably requires the command line version of subversion, so doing an exec on svn.exe is probably just as good.

<exec program="svn.exe" commandline="add..." />