*/
File exportDir = new File("exportované");
if (exportDir.exists()) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR,
"Path ''{0}'' already exists", exportDir);
throw new SVNException(err);
}
exportDir.mkdirs();
/*
* Create an instance of SVNRepository class. This class is the main
* entry point for all "low-level" Subversion operations supported by
* Subversion protocol.
*
* These operations includes browsing, update and commit operations. See
* SVNRepository methods javadoc for more details.
*/
SVNRepository repository = SVNRepositoryFactory.create(url);
/*
* User's authentication information (name/password) is provided via an
* ISVNAuthenticationManager instance. SVNWCUtil creates a default
* authentication manager given user's name and password.
*
* Default authentication manager first attempts to use provided user
* name and password and then falls back to the credentials stored in
* the default Subversion credentials storage that is located in
* Subversion configuration area. If you'd like to use provided user
* name and password only you may use BasicAuthenticationManager class
* instead of default authentication manager:
*
* authManager = new BasicAuthenticationsManager(userName,
* userPassword);
*
* You may also skip this point - anonymous access will be used.
*/
ISVNAuthenticationManager authManager = SVNWCUtil
.createDefaultAuthenticationManager(userName, userPassword);
repository.setAuthenticationManager(authManager);
/*
* Get type of the node located at URL we used to create SVNRepository. ""
* (empty string) is path relative to that URL, -1 is value that mya be
* used to specify HEAD (latest) revision.
*/
SVNNodeKind nodeKind = repository.checkPath("", -1);
if (nodeKind == SVNNodeKind.NONE) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
"No entry at URL ''{0}''", url);
throw new SVNException(err);
} else if (nodeKind == SVNNodeKind.FILE) {
SVNErrorMessage err = SVNErrorMessage
.create(
SVNErrorCode.UNKNOWN,
"Entry at URL ''{0}'' is a file while directory was expected",
url);
throw new SVNException(err);
}
/*
* Get latest repository revision. We will export repository contents at
* this very revision.