SVNKit 1.1.6 开源Subversion工具库发布

SVNKit 是一个完全基于Java的Subversion开源工具库。SVNKit支持Java API控制和操作Subversion工作拷贝和资源。SVNKit支持http,https,svn和svn+ssh连接协议等。

通过SVNKit,你可以很容易的操作控制Subversion。

checks out project from repository:

Java代码

1. File dstPath = new File("c:/svnkit");
2. SVNURL url = SVNURL.
3. parseURIEncoded("http://svn.svnkit.com/repos/svnkit/branches/1.1.x/");
4.
5. SVNClientManager cm = SVNClientManager.newInstance();
6. SVNUpdateClient uc = cm.getUpdateClient();
7. uc.doCheckout(url, dstPath, SVNRevision.UNDEFINED, SVNRevision.HEAD, true);

File dstPath = new File("c:/svnkit");
SVNURL url = SVNURL.
parseURIEncoded("http://svn.svnkit.com/repos/svnkit/branches/1.1.x/");

SVNClientManager cm = SVNClientManager.newInstance();
SVNUpdateClient uc = cm.getUpdateClient();
uc.doCheckout(url, dstPath, SVNRevision.UNDEFINED, SVNRevision.HEAD, true);


Updates it to the latest revision:

Java代码

1. uc.doUpdate(dstPath, SVNRevision.HEAD, true);

uc.doUpdate(dstPath, SVNRevision.HEAD, true);


And finally commits local changes in "www" subdirectory if there are any:

Java代码

1. SVNCommitClient cc = cm.getCommitClient();
2. cc.doCommit(new File[] {new File(dstPath, "www")}, false, "message", false, true);

SVNCommitClient cc = cm.getCommitClient();
cc.doCommit(new File[] {new File(dstPath, "www")}, false, "message", false, true);


Access Subversion repository directly:

Java代码

1. SVNURL url = SVNURL.parseURIEncoded("http://svn.svnkit.com/repos/svnkit/branches/1.1.x/");
2. SVNRepository repos = SVNRepositoryFactory.create(url);
3.
4. long headRevision = repos.getLatestRevision();
5. Collection entriesList = repos.getDir("www", headRevision, null, (Collection) null);
6. for (Iterator entries = entriesList.iterator(); entries.hasNext();) {
7. SVNDirEntry entry = (SVNDirEntry) entries.next();
8. System.out.println("entry: " + entry.getName());
9. System.out.println("last modified at revision: " + entry.getDate() +
10. " by " + entry.getAuthor());
11. }

SVNURL url = SVNURL.parseURIEncoded("http://svn.svnkit.com/repos/svnkit/branches/1.1.x/");
SVNRepository repos = SVNRepositoryFactory.create(url);

long headRevision = repos.getLatestRevision();
Collection entriesList = repos.getDir("www", headRevision, null, (Collection) null);
for (Iterator entries = entriesList.iterator(); entries.hasNext();) {
SVNDirEntry entry = (SVNDirEntry) entries.next();
System.out.println("entry: " + entry.getName());
System.out.println("last modified at revision: " + entry.getDate() +
" by " + entry.getAuthor());
}


Replace JNI Subversion bindings with SVNKit:

Java代码

1. // pure Java implementation of the standard Subversion Java interface
2. SVNClientInterface jniAPI = SVNClientImpl.newInstance();
3. byte[] contents =
4. jniAPI.fileContent("http://svn.svnkit.com/repos/svnkit/branches/1.1.x/changelog.txt",
5. Revision.HEAD);

// pure Java implementation of the standard Subversion Java interface
SVNClientInterface jniAPI = SVNClientImpl.newInstance();
byte[] contents =
jniAPI.fileContent("http://svn.svnkit.com/repos/svnkit/branches/1.1.x/changelog.txt",
Revision.HEAD);


点击下图进入SVNKit官方网站
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值