Java invoke Svnkit to check out the specified version of the file __java

Source: Internet
Author: User
Tags svn svn client
Import Java.io.File;
Import org.tmatesoft.svn.core.SVNException;
Import Org.tmatesoft.svn.core.SVNURL;
Import Org.tmatesoft.svn.core.internal.io.dav.DAVRepositoryFactory;
Import org.tmatesoft.svn.core.internal.wc.DefaultSVNOptions;
Import org.tmatesoft.svn.core.wc.ISVNOptions;
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 Testsvncheckout {//declares the SVN client management class private static Svnclientmanager Ourclientmanager; public static void Main (string[] args) throws Exception {//Initialize the library that supports the SVN://protocol. 
This operation must be performed first.
Davrepositoryfactory.setup ();
Correlation variable assignment Svnurl repositoryurl = null; try {repositoryurl = svnurl.parseuriencoded ("http://localhost/svn/test/svnclient/WebRoot/index.jsp");} catch (
Svnexception e) {//} String name = ' Liuyua ';
String password = "Liuyua";
String Version = "5675";
Isvnoptions options = Svnwcutil.createdefaultoptions (true); instance of the GuestUser-side Management class Ourclientmanager = Svnclientmanager.newinstance (defaultsvnoptions) options, name, password);
The directory File wcdir = new File ("e:/test/") to which you want to check out the contents of the version library;
Obtain an instance of the Updateclient class from the client management class.
Svnupdateclient updateclient = Ourclientmanager.getupdateclient ();
* * Sets externals not to be ignored during the checkout/Updateclient.setignoreexternals (FALSE);
System.out.println ("Start");
Performs a check out operation that returns the version number of the working copy. Long workingversion= updateclient.doexport (Repositoryurl, Wcdir, Svnrevision.head, Svnrevision.parse (version), "",
True, false); System.out.println ("Version:" +workingversion+ check out to directory: "+wcdir+".)

"); }

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.