CVS Task

## Cvs

### Description

Handles packages/modules retrieved from a CVS repository.

Important: This task needs "`cvs`" on the path. If it isn't, you will get an error (such as error `2` on Windows). If `<cvs>` doesn't work, try to execute `cvs.exe` from the command line in the target directory in which you are working. Also note that this task assumes that the cvs executable is compatible with the Unix version, this is not completely true for certain other CVS clients - like CVSNT for example - and some operation may fail when using such an incompatible client.

CVSNT Note: CVSNT prefers users to store the passwords inside the registry. If the cvspass task and the passfile attribute don't seem to work for you, the most likely reason is that CVSNT ignores your .cvspass file completely. See bugzilla report 21657 for recommended workarounds.

### Parameters

Attribute | Description | Required
command | the CVS command to execute. | No, default "checkout".
compression | `true` or `false` - if set to true, this is the same as `compressionlevel="3"` | No. Defaults to false.
compressionlevel | A number between 1 and 9 (corresponding to possible values for CVS' `-z#` argument). Any other value is treated as `compression="false"` | No. Defaults to no compression.
cvsRoot | the `CVSROOT` variable. | No
cvsRsh | the `CVS_RSH` variable. | No
dest | the directory where the checked out files should be placed. Note that this is different from CVS's `-d` command line switch as Apache Ant will never shorten pathnames to avoid empty directories. | No, default is project's basedir.
package | the package/module to check out. Note: multiple attributes can be split using spaces. Use a nested <module> element if you want to specify a module with spaces in its name. | No
tag | the tag of the package/module to check out. | No
date | Use the most recent revision no later than the given date | No
quiet | suppress informational messages. This is the same as `-q` on the command line. | No, default "false"
reallyquiet | suppress all messages. This is the same as `-Q` on the command line. since Ant 1.6. | No, default "false"
noexec | report only, don't change any files. | No, default to "false"
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".
port | Port used by CVS to communicate with the server. | No, default port `2401`.
passfile | Password file to read passwords from. | No, default file `~/.cvspass`.
failonerror | Stop the build process if the command exits with a return code other than `0`. Defaults to "false" | No

### Parameters specified as nested elements

#### module

Specifies a package/module to work on, unlike the package attribute modules specified using this attribute can contain spaces in their name.

Attribute | Description | Required
name | The module's/package's name. | Yes.

### Examples

      <cvs cvsRoot=":pserver:anoncvs@cvs.apache.org:/home/cvspublic"
           package="ant"
           dest="${ws.dir}"/>

checks out the package/module "ant" from the CVS repository pointed to by the `cvsRoot` attribute, and stores the files in "`${ws.dir}`".

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

updates the package/module that has previously been checked out into "`${ws.dir}`".

      <cvs command="-q diff -u -N" output="patch.txt"/>

silently (`-q`) creates a file called `patch.txt` which contains a unified (`-u`) diff which includes new files added via "cvs add" (`-N`) and can be used as input to patch. The equivalent, using `<commandline>` elements, is:

    <cvs output="patch">
        <commandline>
            <argument value="-q"/>
            <argument value="diff"/>
            <argument value="-u"/>
            <argument value="-N"/>
        </commandline>
    </cvs>

or:

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

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

      <cvs command="update -A -d"/>

Updates from the head of repository ignoring sticky bits (`-A`) and creating any new directories as necessary (`-d`).

Note: the text of the command is passed to cvs "as-is" so any cvs options should appear before the command, and any command options should appear after the command as in the diff example above. See the cvs manual for details, specifically the Guide to CVS commands