Subversion Module

What is the subversion module?

The subversion module allows you to call subversion functions directly from within XQuery. You can do things such as:

  • List the contents of a subversion repository including commit history and commit messages

  • Checkout a subversion directory directly into an exist collection

  • Make changes to local files

  • Commit the changes back to the repository

  • Get the status of local subversion files

This document shows you how to use the subversion module to do these functions.

Enableing the subversion module

To enable the subversion module you must do the following steps:

  • In the $EXIST_HOME/extensions/ file set the svn feature to be true

    include.feature.svn = true

  • Then uncomment the following line in the conf.xml file:

    <module uri="" class="org.exist.versioning.svn.xquery.SVNModule" />

  • Stop the exist sever

  • Recompile the eXist system using the build script.

Functions tested

The following functiosn have been tested.

subversion:checkout($repository-uri as xs:string, $database-path as xs:string) xs:long
subversion:checkout($repository-uri as xs:string, $database-path as xs:string, $login as xs:string, $password as xs:string) xs:long 
subversion:get-latest-revision-number($repository-uri as xs:string, $login as
                xs:string, $password as xs:string) xs:long * subversion:info($database-path as
                xs:string) element() * subversion:list($repository-uri as xs:string) element()
subversion:log($repository-uri as xs:string, $login as xs:string, $password as
                xs:string, $start-revision as xs:integer?, $end-revision as xs:integer?) element()
subversion:status($database-path as xs:string) element()
subversion:update($database-path as xs:string) xs:long
subversion:update($database-path as xs:string, $login as xs:string, $passwrod as
                xs:string) xs:long * subversion:add($database-path as xs:string) empty()
subversion:commit($database-path as xs:string, $message as xs:string?, $login as
                xs:string, $password as xs:string) xs:long * subversion:clean-up($database-path as
                xs:string) empty() * subversion:lock($database-path as xs:string, $message as
                xs:string?) empty() * subversion:revert($database-path as xs:string) empty()
subversion:unlock($database-path as xs:string) empty()

Sample programs

The following are sample programs that use the subversion library

List the latest revision number from the eXist subversion repository

xquery version "1.0";
import module namespace subversion = ""; 
let $repository-uri := xs:anyURI('')
(: put your sourceforge account name and password here :)
let $username := ''
let $password := ''
  subversion:get-latest-revision-number($repository-uri, $username, $password)


XQuery Wikibook Article on Subversion