Over a million developers have joined DZone.

SVNKit: Tame Subversion with Java!

· Java Zone

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

SVNKitis an Open Source pure Java Subversion library. SVNKit literally brings Subversion, popular open source version control system, to the Java world.

With SVNKit you can do the following:

All standard Subversion operations:

For instance, the following snipped checks out project from repository:

   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:

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

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

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

SVNKit supports all standard Subversion operations and compatible with the latest version of Subversion.

Access Subversion repository directly:

Some applications will benefit from working with repository directly, without keeping working copy locally. Example below displays list of files in "www" directory.

   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());   }

Direct repository access API allows to perform operations like update, commit, diff and many other. Additionaly to the performance benefits of the direct access to repository, this API makes it possible to version arbitrary objects or object models within Subevrsion repository, not only files from the file system.

Replace JNI Subversion bindings with SVNKit:

Native Subversion provides Java interface that works with Subversion binaries through JNI. In case you already using it or would like to use as an option, you may also use SVNKit through exactly the same interface. This way you'll let your application dynamically switch between JNI and SVNKit implementation of the same API or let your application work on the platforms where there are no native Subversion binaries. For example:

   // 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 is widely used in different applications, including IntelliJ IDEA, Eclipse Subversion integrations, SmartSVN, JDeveloper, bug tracking server side applications (e.g. Atlassian JIRA) and repository management and tracking tools (e.g. Atlassian FishEye) and many others.

Where to get more information:

Recently we've released SVNKit version 1.1.6 which is bugfix release. At http://svnkit.com/ you will find more information on that new version and, of course, downloads, documentation, source code example and articles explaining how to use SVNKit. In case of any questions you're welcome at our mailing list, or just contact us at support@svnkit.com

SVNKit is widely used in different applications, including IntelliJ IDEA, Eclipse Subversion integrations, SmartSVN, JDeveloper, bug tracking server side applications (e.g. Atlassian JIRA) and repository management and tracking tools (e.g. Atlassian FishEye) and many others.

With best regards,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!

The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.

Topics:
java

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}