Export files and directories from a Subversion repository
| Package: | org.tmatesoft.svn |
| Category: | Source code management tasks |
| Since: | 0.7 |
| EntityFS-aware? | Yes |
Description
Export files and directories from a Subversion repository. It does not export any Subversion
metadata (.svn directories), just the contents of the repository.
This corresponds to the svn export command.
The task uses the SVNKit client library for Subversion access.
SVNKit uses an authentication manager with an
authentication provider for authenticating against a Subversion repository.
The default authentication manager and provider use the credentials that are
stored for the user running the script (in the ~/.svn directory on
Unix).
The script can use another authentication manager by setting the
authenticationManager property. The default
authentication manager can be used with a custom authentication provider by
setting the authenticationProvider property. Schmant
comes with two custom authentication provider implementations:
- PromptingAuthenticationProvider – prompt for username and password on the script console if required. This requires that the script has an attached console, i.e. that it is run interactively (see Console).
- UsernamePasswordAuthenticationProvider – use a username and password hard-coded in the script.
Required properties
Properties
| authenticationManager | top |
Use this property to set a custom
ISVNAutenticationManager to use for authentication
against the Subversion server. If this is set, any
authenticationProvider set will not be used.
Often it suffices to just set an
authenticationProvider.
- Setter method:
-
setAuthenticationManager(ISVNAuthenticationManager m)
where:
m– Authentication manager.
- See also:
- authenticationProvider
| authenticationProvider | top |
An ISVNAuthenticationProvider to use for collecting user credentials when the Subversion server prompts for them.
Two implementations are:
- PromptingAuthenticationProvider – prompt for username and password
- UsernamePasswordAuthenticationProvider – use a preconfigured username and password pair.
If this is not set, the default authentication provider is used. It uses
the credentials already stored in the local Subversion configuration directory
for the user running the script. (~/.subversion on Unix.) If it
does not have the requested credentials, the task fails.
If a custom authenticationManager is
used, this property is not used.
- Setter method:
-
setAuthenticationProvider(ISVNAuthenticationProvider p)
where:
p– An authentication provider.
- See also:
- authenticationManager
| configurators | top |
A collection of Configurator:s. Configurator:s are used to configure a task right before it is run in a TaskExecutor with properties that are not available until all of the task's dependencies have been run.
Build scripts that don't use TaskExecutor:s don't have to use Configurator:s.
- Setter method:
-
addConfigurator(Configurator cf)
where:
cf– A configurator.
Add one configurator. - Setter method:
-
addConfigurators(Collection<? extends Configurator> c)
where:
c– A collection of configurators.
Add a collection of configurators.
| logFooter | top |
The message that is logged to info level
after the task has been successfully run.
- Setter method:
-
setLogFooter(java.lang.String s)
where:
s– The footer message.
- Default value:
- Empty (no footer message is logged.)
| logHeader | top |
The message that is logged to info level
before the task is run.
- Setter method:
-
setLogHeader(java.lang.String s)
where:
s– The header message.
- Default value:
- A task class specific message.
| overwrite | top |
If an entity already exists in the target location, should it be
overwritten? If false, the task throws an error instead.
- Setter method:
-
setOverwrite(boolean b)
where:
b– Should an existing entity be overwritten?
- Default value:
false(existing entities are not overwritten).- See also:
- target
| recursive | top |
Should the contents of the repository be exported recursively? If not and the repository URL points to a directory, only the immediate contents of that directory will be exported.
- Setter method:
-
setRecursive(boolean b)
where:
b– Recursive?
- Default value:
true
| repositoryLocation (required) | top |
The location of the Subversion repository. The task
supports file://, svn[+xxx]:// and
http[s]:// URL:s.
- Setter method:
-
setRepositoryLocation(java.lang.String s)
where:
s– The repository location. It is parsed using the SVNURL.parseURIDecoded method.
- Setter method:
-
setRepositoryLocation(SVNURL l)
where:
l– The repository location.
| revision | top |
The revision number of the contents to export. Set to
-1 to export the latest revision.
- Setter method:
-
setRevision(long no)
where:
no– Revision number.
Set the revision number. - Default value:
-1, i.e. the latest revision.
| target (required) | top |
Target directory for the export.
- Setter method:
-
setTarget(java.lang.Object o)
where:
o– The target directory. Interpreted by|ai_read_write_directory;ArgumentInterpreter.getReadWriteDirectory(java.lang.Object)|.
Examples
Example 1
Export the contents of the latest revision of a Subversion reposotory to a temporary directory.
// repl is a String containing a repository location, for instance
// https://my.svn.server.com/my_project/trunk
// dstDir is the target directory
new SvnExportTF().
setRepositoryLocation(repl).
setTarget(dstDir).
// Prompt for credentials
setAuthenticationProvider(
new PromptingAuthenticationProvider()).run();
An EntityFS-aware
task is implemented using EntityFS. This means that it uses the filter settings
of DirectoryView:s and also that it often can work with other
file system implementations than File-based, such as the
RAM file system.