by
3 6
1
3
382k
18
Top 1% !
Pearl of Wisdom
Specified
Popularity: 2294th place

Published on:

No tags for this snippet yet.
LanguageJava
SourceGitHub

SVNKit export from Subversion example

SVNKit export from Subversion example: 
SvnExportExample.java
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/690220/SVNKit-export-from-Subversion-example?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
import java.io.File; 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 org.tmatesoft.svn.core.io.SVNRepository; import org.tmatesoft.svn.core.io.SVNRepositoryFactory; 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://cavcops01.global.local/skunkworks"; 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