<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>Subversion Task</title>
<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
</head>

<body>

<h2><a name="svn">SVN</a></h2>
<h3>Description</h3>
<p>Handles packages/modules retrieved from a
<a href="http://subversion.tigris.org/" target="_top">Subversion</a> repository.</p>
<p><b>Important:</b> This task needs &quot;<code>svn</code>&quot; on the path. If it isn't, you will get
an error (such as error <code>2</code> on windows). If <code>&lt;svn&gt;</code> doesn't work, try to execute <code>svn.exe</code>
from the command line in the target directory in which you are working.
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">subcommand</td>
    <td valign="top">the SVN subcommand to execute.</td>
    <td align="center" valign="top">No, default &quot;checkout&quot;.</td>
  </tr>
  <tr>
    <td valign="top">svnURL</td>
    <td valign="top">the URL the subcommand should apply to.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">dest</td>
    <td valign="top">the directory where the checked out files should
    be placed.  Note that this is different from SVN's <code>-d</code> command line
    switch as Ant will never shorten pathnames to avoid empty
    directories.</td>
    <td align="center" valign="top">No, default is project's basedir.</td>
  </tr>
  <tr>
    <td valign="top">revision</td>
    <td valign="top">the revision or date of the subcommand should apply to</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">quiet</td>
    <td valign="top">suppress informational messages. This is the same as <code>--quiet</code> on the command line.</td>
    <td align="center" valign="top">No, default &quot;false&quot;</td>
  </tr>
  <tr>
    <td valign="top">verbose</td>
    <td valign="top">Be verbose. This is the same as <code>--verbose</code> on the command line.</td>
    <td align="center" valign="top">No, default &quot;false&quot;</td>
  </tr>
  <tr>
    <td valign="top">dryrun</td>
    <td valign="top">report only, don't change any files.</td>
    <td align="center" valign="top">No, default to &quot;false&quot;</td>
  </tr>
  <tr>
    <td valign="top">file</td>
    <td valign="top">Uses the contents of the file passed as an
    argument to this switch for the specified subcommand.</td>
    <td align="center" valign="top">No.</td>
  </tr>
  <tr>
    <td valign="top">force</td>
    <td valign="top">Forces a particular command or operation to run.</td>
    <td align="center" valign="top">No, defaults to false.</td>
  </tr>
  <tr>
    <td valign="top">recursive</td>
    <td valign="top">Makes a subcommand recurse into
    subdirectories. Most subcommands recurse by default.</td>
    <td align="center" valign="top">No.</td>
  </tr>
  <tr>
    <td valign="top">targets</td>
    <td valign="top">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.</td>
    <td align="center" valign="top">No.</td>
  </tr>
  <tr>
    <td valign="top">output</td>
    <td valign="top">the file to direct standard output from the command.</td>
    <td align="center" valign="top">No, default output to ANT Log as <code>MSG_INFO</code>.</td>
  </tr>
  <tr>
    <td valign="top">error</td>
    <td valign="top">the file to direct standard error from the command.</td>
    <td align="center" valign="top">No, default error to ANT Log as <code>MSG_WARN</code>.</td>
  </tr>
  <tr>
    <td valign="top">append</td>
    <td valign="top">whether to append output/error when redirecting to a file.</td>
    <td align="center" valign="top">No, default to &quot;false&quot;.</td>
  </tr>
  <tr>
    <td valign="top">failonerror</td>
    <td valign="top">Stop the build process if the command exits with a
      return code other than <code>0</code>. Defaults to &quot;false&quot;</td>
    <td align="center" valign="top">No</td>
  </tr>
</table>
<h3>Examples</h3>
<pre>  &lt;svn svnURL=&quot;http://svn.apache.org/repos/asf/httpd/httpd/trunk/&quot;
       dest=&quot;${ws.dir}&quot;
  /&gt;</pre>
<p>checks out the URL
&quot;http://svn.apache.org/repos/asf/httpd/httpd/trunk/&quot; and
stores the files in &quot;<code>${ws.dir}</code>&quot;.</p>
<pre>  &lt;svn dest=&quot;${ws.dir}&quot; command=&quot;update&quot;/&gt;</pre>
<p>updates the working copy that has previously been checked out into
&quot;<code>${ws.dir}</code>&quot;.</p>

<pre>  &lt;svn command=&quot;-q diff&quot; output=&quot;patch.txt&quot;/&gt;</pre>

<p>silently (<code>-q</code>) creates a file called <code>patch.txt</code> which contains a unified diff which can be used as input to patch.
The equivalent, using  <code>&lt;commandline&gt;</code> elements, is:
</p>
<pre>
&lt;svn output=&quot;patch&quot;&gt;
    &lt;commandline&gt;
        &lt;argument value=&quot;-q&quot;/&gt;
        &lt;argument value=&quot;diff&quot;/&gt;
    &lt;/commandline&gt;
&lt;/svn&gt;
</pre>
or:
<pre>
&lt;svn output=&quot;patch&quot;&gt;
    &lt;commandline&gt;
        &lt;argument line=&quot;-q diff -u -N&quot;/&gt;
    &lt;/commandline&gt;
&lt;/svn&gt;
</pre>
<p>
You may include as many <code>&lt;commandline&gt;</code> elements as you like. 
Each will inherit the <code>failonerror</code> and other &quot;global&quot; parameters
from the <code>&lt;svn&gt;</code> element.
</p>

<pre>  &lt;svn command=&quot;update&quot;/&gt;</pre>
<p>Updates from the head of repository creating any new directories as necessary.</p>
<p>See <a href="http://svnbook.red-bean.com/en/1.1/ch09.html#svn-ch-9-sect-1" target="_top">Version Control with Subversion</a> for details,
specifically the <a href="http://svnbook.red-bean.com/en/1.1/ch09.html#svn-ch-9-sect-1" target="_top">The Subversion Command Line Client: svn</a></p>
<hr>
<p align="center">Copyright &copy; 2005 The Apache Software
Foundation.  All rights Reserved.</p>

</body>
</html>