XQuery/Installing eXgit
Background
[edit | edit source]Git has many features for managing data when many users are changing files around the world. Git has tools for seeing who has changed what data and how to view the differences. These features are not available in eXist (yet). However their is no standard REST interface for git.
Installing eXgit
[edit | edit source]Note: this is a work in progress. Not done! We hope to have a packaging tool and a simple to install .xar file in the future.
The software for eXgit is stored on github here:
https://github.com/shabanovd/eXgit
This software depends on the Git Java library here:
https://github.com/eclipse/egit-github
You will need to build this project but the ONLY jar you need is:
org.eclipse.jgit.jar (Note, this is a 1.7MB file)
To build this I downloaded the zip file from github and did "mvn install". I did get errors so I had to do Mavin build with no tests:
mvn install -Dmaven.test.skip=true
Once you have both the jar files you can put them into $EXIST/lib/user
eXgit-0.3.0.jar org.eclipse.jgit.jar
You can now build the "xar file:
$ ant
This will put a build/eXgit-0.2.2.xar (about 1.6MB with the two jar files)
You can then load this into your eXist dashboard.
Note, for some reason the jar files are not working. We removed the reference to them in exist.xml and the build file and just manually copied them into the $EXIST_HOME/lib/user area.
Note that now the .xar file is about 2K!
Testing Installation
[edit | edit source]You must have a local git checkout.
Use this as your import statement:
import module namespace git="http://exist-db.org/git";
Sample XUnit Test
[edit | edit source]To test this you can clone any git repository. For example the following will make a copy of the eXide project in /db/exide.
xquery version "1.0";
import module namespace git="http://exist-db.org/git";
git:clone("https://github.com/wolfgangmm/eXide.git", "/db/exide", "", "")
After this test runs you will notice that a .git file has been created in /db/exide/.git with all the git administrative files
Sample Unit Test
[edit | edit source]import module namespace git="http://exist-db.org/git";
let $git-checkout-dir := 'd:\ws\exist'
return
<testcase name="status" classname="http://exist-db.org/git">
{git:status($git-checkout-dir, '', false())}
</testcase>