자바 에서 svnkit 를 호출 하여 지정 한 버 전의 파일 을 검출 합 니 다.
1719 단어 【Java】
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 {
// SVN
private static SVNClientManager ourClientManager;
public static void main(String[] args) throws Exception {
// svn:// 。 。
DAVRepositoryFactory.setup();
//
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);
//
ourClientManager = SVNClientManager.newInstance((DefaultSVNOptions) options, name, password);
// check out
File wcDir = new File("e:/test/");
// updateClient 。
SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
/*
* sets externals not to be ignored during the checkout
*/
updateClient.setIgnoreExternals(false);
System.out.println(" ");
// check out , 。
long workingVersion= updateClient.doExport(repositoryURL, wcDir, SVNRevision.HEAD, SVNRevision.parse(version), "", true, false);
System.out.println(" :"+workingVersion+" check out :"+wcDir+" 。");
}