问题描述:

I'm trying to do an automatic checkout from Subversion. But the problem is, it is not working for me. I did this:

"C:\Program Files\TortoiseSVN\bin\TortoiseProc.exe" /command:checkout /path:"C:\Program\Client" /url:"http://subversion/svn/Client/ClientsVersion/trunk/"

But then I need to click on 'OK' and type my username + password. But I want to execute a command and then everything is done.

I'm executing the command in Java with Runtime.getRuntime().exec("cmd /c start CODE");, So if there is another solution in Java that also will work for me!

This is now my code and working for svnKit version 1.3.7

File dstPath = new File("c:/svnkit");

SVNURL url;

url = SVNURL.parseURIEncoded("http://subversion/svn/directory/project/trunk/");

ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("USERNAME", "PASS" );

SVNUpdateClient uc = new SVNUpdateClient(authManager , SVNWCUtil.createDefaultOptions(true));

uc.doCheckout(url, dstPath, SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNDepth.INFINITY, true);

网友答案:

I would suggest to use the command line client (svn.exe instead of TortoiseSVN) for checking out via java. Furthermore if you really need a solution for Java only you can take a look into svnkit.com for native Java library which means you don't need calling a command line client anymore. Currently the svnkit library doesn't support 1.7 (but via an alpha version).

相关阅读:
Top