java svnkit實現svn提交,更新等操作


官網:https://svnkit.com/

api:https://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html

wiki手冊:https://wiki.svnkit.com/Getting_Started_With_SVNKit

幾個例子

http://blog.csdn.net/hardwin/article/details/7963318

https://svnkit.com/javadoc/org/tmatesoft/svn/core/io/SVNRepository.html

http://www.cnblogs.com/wangjiyuan/p/svnkitwanchenglizi.html

http://xiangxji.iteye.com/blog/854773

http://blog.csdn.net/feiren127/article/details/7551782

#####################################################################

SVNKit的API主要分為兩類:High Level API和Low Level API。 
通常情況下,我們使用High Level API即可完成工作任務。High Level API通過封裝、使用Low Level API,使開發工作變得相對簡單、容易。在此我們重點介紹High Level API。

一、建立倉庫

public static SVNRepository getRepository(String url, String username, String password) {
    DAVRepositoryFactory.setup();
    SVNRepositoryFactoryImpl.setup();
    SVNRepository repository = null;
    SVNNodeKind nodeKind = null;
    try {
        repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
        ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(username, password);
        repository.setAuthenticationManager(authManager);
        nodeKind = repository.checkPath("", -1);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    if (nodeKind == SVNNodeKind.NONE) {
        throw new RuntimeException("There is no entry at '" + url + "'.");
    } else if (nodeKind == SVNNodeKind.FILE) {
        throw new RuntimeException("The entry at '" + url + "' is a file while a directory was expected.");
    }
    return repository;
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM