# Subversion Task

## SVN

### Description

Handles packages/modules retrieved from a Subversion repository.

Important: This task needs "`svn`" on the path. If it isn't, you will get an error (such as error `2` on windows). If `<svn>` doesn't work, try to execute `svn.exe` from the command line in the target directory in which you are working.

### Parameters

Attribute | Description | Required
subcommand | the SVN subcommand to execute. | No, default "checkout".
svnURL | the URL the subcommand should apply to. | No
dest | the directory where the checked out files should be placed. Note that this is different from SVN's `-d` command line switch as Ant will never shorten pathnames to avoid empty directories. | No, default is project's basedir.
revision | the revision or date of the subcommand should apply to | No
quiet | suppress informational messages. This is the same as `--quiet` on the command line. | No, default "false"
verbose | Be verbose. This is the same as `--verbose` on the command line. | No, default "false"
dryrun | report only, don't change any files. | No, default to "false"
file | Uses the contents of the file passed as an argument to this switch for the specified subcommand. | No.
force | Forces a particular command or operation to run. | No, defaults to false.
recursive | Makes a subcommand recurse into subdirectories. Most subcommands recurse by default. | No.
targets | Tells Subversion to get the list of files that you wish to operate on from the filename you provide instead of listing all the files on the command line. | No.
output | the file to direct standard output from the command. | No, default output to ANT Log as `MSG_INFO`.
error | the file to direct standard error from the command. | No, default error to ANT Log as `MSG_WARN`.
append | whether to append output/error when redirecting to a file. | No, default to "false".
failonerror | Stop the build process if the command exits with a return code other than `0`. Defaults to "false" | No

### Examples

      <svn svnURL="http://svn.apache.org/repos/asf/httpd/httpd/trunk/"
           dest="${ws.dir}"
      />

checks out the URL "http://svn.apache.org/repos/asf/httpd/httpd/trunk/" and stores the files in "`${ws.dir}`".

      <svn dest="${ws.dir}" command="update"/>

updates the working copy that has previously been checked out into "`${ws.dir}`".

      <svn command="-q diff" output="patch.txt"/>

silently (`-q`) creates a file called `patch.txt` which contains a unified diff which can be used as input to patch. The equivalent, using `<commandline>` elements, is:

    <svn output="patch">
        <commandline>
            <argument value="-q"/>
            <argument value="diff"/>
        </commandline>
    </svn>

or:

    <svn output="patch">
        <commandline>
            <argument line="-q diff -u -N"/>
        </commandline>
    </svn>

You may include as many `<commandline>` elements as you like. Each will inherit the `failonerror` and other "global" parameters from the `<svn>` element.

      <svn command="update"/>

Updates from the head of repository creating any new directories as necessary.

See Version Control with Subversion for details, specifically the The Subversion Command Line Client: svn

Copyright © 2005 The Apache Software Foundation. All rights Reserved.