tinti
tinti

Reputation: 1475

SVN Ant Update example

I'm quite new in Ant and i want to make an SVN Update operation. I add the jar files into the ant/lib folder, also i add the typedef property in my build.xml file.

<typedef resource="org/tigris/subversion/svnant/svnantlib.xml" classpath="ant/lib/svnant.jar;ant/lib/svnClientAdapter.jar;ant/lib/svnkit.jar;ant/lib/svnjavahl.jar" />

But now I need some code example for making update from repository at one folder (let's say the folder name is test) I look over internet but a few examples are provided with this svn ant call.

I've tried something like this

<target name="svn-update">
    <svn username="test" password="*****">
        <update revision="HEAD" dir="com.project.blackbox.eclipse" />
    </svn>
</target>

Upvotes: 4

Views: 18292

Answers (3)

Simple-Solution
Simple-Solution

Reputation: 4289

Here is a simple solution mate:

Requirement:

tortisesvn version - 1.7
subversuin version - 1.7
Ant version - 1.8 

Make sure you checkout with with new version of tortisesvn client. 

<!-- Execute svn update command -->
<target name="fetch-update-code" description="Fetches update code from base/current working repository" >
    <exec executable="svn" dir="D:/opt/trunk" spawn="false">
        <arg value="update" />
        <arg value="--username=${svn.username}" />
        <arg value="--password=${svn.password}" />
    </exec>
</target>


 Hope this helps: 

Upvotes: 2

Edwin Buck
Edwin Buck

Reputation: 70909

You have the typedefs right.

What you are trying to do is update to a directory which wasn't checked out by SVN. This means that your likely have the wrong directory in your "dir" attribute.

If your "dir" attribute points to the project's root directory, odds are it is wrong. You likely checked out to a "src" folder under the project's root directory.

Look in the Project's root directory (typically it is under the Workspace "root" directory, in a directory with the same name as the project). Look for any subdirectories that contain a ".svn" hidden directory. Odds are you only checked out from one repository, so if that's true then the first one you find will likely be the directory you meant to include in the "dir" directive.

If you have multiple directories to select from, at the command line do a "svn info ." for each candidate directory and you will soon be able to sort them out.

Upvotes: 2

splash
splash

Reputation: 13327

I think it should work if you use path delimiters in the dir attribute:

<svn username="test" password="*****">
    <update revision="HEAD" dir="${basedir}/com.project.blackbox.eclipse" />
</svn>

There should be nothing special with the update command. You just have to make sure that you are using the correct directory and it have to be a svn working copy.

Upvotes: 0

Related Questions