<?xml version="1.0" encoding="UTF-8"?>
<!-- $Id: template.xml 17299 2012-10-10 23:47:33Z joewiz $ --><!-- This is a template for writing documentation for the eXist-db project.
     Please copy this and change the data and replace the author information. --><book><bookinfo><productname>Subversion Module</productname><title>Subversion Module</title><date>October 2012</date><author><surname>McCreary</surname><firstname>Dan</firstname></author></bookinfo><chapter><title>Subversion Module</title><section><title>What is the subversion module?</title><para>The subversion module allows you to call subversion functions directly from within
                XQuery. You can do things such as: <itemizedlist><listitem><para>List the contents of a subversion repository including commit history
                            and commit messages</para></listitem><listitem><para>Checkout a subversion directory directly into an exist
                            collection</para></listitem><listitem><para>Make changes to local files</para></listitem><listitem><para>Commit the changes back to the repository</para></listitem><listitem><para>Get the status of local subversion files</para></listitem></itemizedlist> This document shows you how to use the subversion module to do these
                functions.</para></section><section><title>Enableing the subversion module</title><para> To enable the subversion module you must do the following steps: <itemizedlist><listitem><para>In the $EXIST_HOME/extensions/build.properties file set the svn
                            feature to be true
                            <programlisting>include.feature.svn = true</programlisting></para></listitem><listitem><para>Then uncomment the following line in the conf.xml file:
                            <programlisting>&lt;module uri="http://exist-db.org/xquery/versioning/svn" class="org.exist.versioning.svn.xquery.SVNModule" /&gt;</programlisting></para></listitem><listitem><para>Stop the exist sever</para></listitem><listitem><para>Recompile the eXist system using the build script.</para></listitem></itemizedlist></para></section><section><title>Functions tested</title><para>The following functiosn have been tested. <programlisting>subversion:checkout($repository-uri as xs:string, $database-path as xs:string) xs:long</programlisting><programlisting>subversion:checkout($repository-uri as xs:string, $database-path as xs:string, $login as xs:string, $password as xs:string) xs:long </programlisting><programlisting>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()</programlisting><programlisting>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()</programlisting><programlisting>subversion:status($database-path as xs:string) element()</programlisting><programlisting>subversion:update($database-path as xs:string) xs:long</programlisting><programlisting>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()</programlisting><programlisting>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()</programlisting><programlisting>subversion:unlock($database-path as xs:string) empty()</programlisting></para></section><section><title>Sample programs</title><para>The following are sample programs that use the subversion library</para><para>
                List the latest revision number from the eXist subversion repository
                <programlisting>
                    xquery version "1.0";
 
import module namespace subversion = "http://exist-db.org/xquery/versioning/svn"; 
 
let $repository-uri := xs:anyURI('https://svn.code.sf.net/p/exist/code')
(: put your sourceforge account name and password here :)
let $username := ''
let $password := ''
return
  subversion:get-latest-revision-number($repository-uri, $username, $password)
                </programlisting></para></section><bibliography><biblioentry><title>XQuery Wikibook Article on Subversion</title><biblioid><ulink url="http://en.wikibooks.org/wiki/XQuery/Subversion">http://en.wikibooks.org/wiki/XQuery/Subversion</ulink></biblioid></biblioentry></bibliography></chapter></book>