Checking Out Directory / File with SVNKit

I can't see on the wiki where checking out is documented. Ideally, I would like to check out a file "example/folder/file.xml", if not just the folder... and then when the application closes down or otherwise, be able to commit back in changes to this file. How do I do this?


You cannot check out a file in Subversion. You have to check out a folder.

To check out a folder with one or more files:

SVNClientManager ourClientManager = SVNClientManager.newInstance(null, 
SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
updateClient.doCheckout(url, destPath, revision, revision,

To commit a previously checked out folder:

SVNClientManager ourClientManager = SVNClientManager.newInstance(null, 
ourClientManager.getWCClient().doInfo(wcPath, SVNRevision.HEAD);
        (new File[] { wcPath }, keepLocks, commitMessage, false, true);

As SVNKit developer, I would recommend you to prefer new API based on SvnOperationFactory. The old API (based on SVNClientManager) will be operational still but all new SVN features will come only to the new API.

final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
try {
    final SvnCheckout checkout = svnOperationFactory.createCheckout();
    //... other options;
} finally {

I also used the code snippet proposed by Dmitry Pavlenko and I had no problems. But it took nearly 30 minutes to checkout or update a repo struture of 35 MB. It's not useable in my usecase (simply checking out a directory structure as part of the content/documents/media of a web application). Or have I made some errors?

final ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(name, password);
final SVNURL svnUrl = SVNURL.create(url.getProtocol(), name, url.getHost(), 443, url.getPath(), true);

SVNRepository svnRepo= SVNRepositoryFactory.create(svnUrl);

SVNDirEntry entry =".", -1);
long remoteRevision = entry.getRevision();

if (!workingCopyDirectory.exists()) {

final SvnCheckout checkout = svnOperationFactory.createCheckout();
remoteRevision =;

Need Your Help

wicket login page with database connectivity

java jdbc wicket

i have been given a project to develop a login page that checks whether user exist in postgres db and allow him to log in otherwise ask him to log as a new user i have entered the if clause also bu...

Can Java Threads be executed in multiprocessor environment?

java multithreading operating-system

I have learnt while studying operating system concepts that there are two types of Threads : Kernel level and User level.