3 6
Top 1% !
Pearl of Wisdom
Popularity: 2294th place

Published on:

No tags for this snippet yet.

SVNKit export from Subversion example

SVNKit export from Subversion example:
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
import; import org.tmatesoft.svn.core.SVNDepth; import org.tmatesoft.svn.core.SVNException; import org.tmatesoft.svn.core.SVNURL; import org.tmatesoft.svn.core.auth.ISVNAuthenticationManager; import; import; import org.tmatesoft.svn.core.wc.SVNClientManager; import org.tmatesoft.svn.core.wc.SVNRevision; import org.tmatesoft.svn.core.wc.SVNUpdateClient; import org.tmatesoft.svn.core.wc.SVNWCUtil; public class SvnExportExample { public static void main(String... args){ final String url = "svn://"; final String destPath = "c:/temp/svntest"; SVNRepository repository = null; try{ //initiate the reporitory from the url repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url)); //create authentication data ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager("cliff.darling", "svnuser"); repository.setAuthenticationManager(authManager); //output some data to verify connection System.out.println( "Repository Root: " + repository.getRepositoryRoot( true ) ); System.out.println( "Repository UUID: " + repository.getRepositoryUUID( true ) ); //need to identify latest revision long latestRevision = repository.getLatestRevision(); System.out.println( "Repository Latest Revision: " + latestRevision); //create client manager and set authentication SVNClientManager ourClientManager = SVNClientManager.newInstance(); ourClientManager.setAuthenticationManager(authManager); //use SVNUpdateClient to do the export SVNUpdateClient updateClient = ourClientManager.getUpdateClient( ); updateClient.setIgnoreExternals( false ); updateClient.doExport( repository.getLocation(), new File(destPath), SVNRevision.create(latestRevision), SVNRevision.create(latestRevision), null, true, SVNDepth.INFINITY); } catch (SVNException e) { e.printStackTrace(); }finally { System.out.println("Done"); } } }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus