subversion-clj
Clojure library for working with Subversion repositories
This code is initially extracted from beanstalkapp.com caching daemon[1]. It's a work in progress, so be careful with updates to new versions. The API may change, although I'm trying to keep thing compatible.
Based on SVNKit, tested with Subversion up to 1.7.9.
[1] Post in Beanstalk's blog about this
Install
Available from Clojars.
Usage
API documentation with some examples, generated by awesome Marginalia.
; This needs to be pointed to your repo, not working copy
(repo-for "file:///some/path/on-your/disk/repo")
; Connecting to remote repository with authentication
(repo-for "https://wildbit.svn.beanstalkapp.com/test-repo" "my-login" "my-password")
; Finds revision 100 in repo and returns it
(revision-for repo 100)
; Finds all revisions in the repo
(revisions-for repo)
; Finds youngest revision of the repo
(youngest repo)
; Gets UUID of the repo
(uuid repo)
Examples
Revision records
; Deleted directory
{:revision 7
:author "dsabanin"
:message "removed directory"
:changes [["dir" "some-directory" :delete]]}
; Edited files
{:revision 11
:author "dsabanin"
:message "editing files"
:changes [["file" "file-abc" :edit]
["file" "file-def" :edit]]}
; Copied directory
{:revision 6
:author "dsabanin"
:message "copied dir"
:changes [["dir" ["new-directory" "old-directory" 5] :copy]]}
Create a Branch
(def repo "https://wildbit.svn.beanstalkapp.com/my-repo")
(def client (core/client-manager "ledet" "password"))
(copy-url client (str repo "/trunk") (str repo "/branches/new-feature") "Created new-feature branch from trunk")
Credits
SVNKit by TMate Software for a very powerful API to build upon.
License
Copyright (C) 2013 Dima Sabanin
Distributed under the Eclipse Public License, the same as Clojure.