I'm using git for a lot of things but I was looking for a way to use my current Oddmuse setup with git. Especially to be able to do off-line edit, staging with experimental pages or use my favorite console editor to edit my wiki pages. I experimented something the 24th December 2008 with two simple bash script to import and export from and to Oddmuse wiki engine.
My oddmuse2git and git2oddmuse experimentation is available in my messy/experimental git repository.
OddmuseGit is using the standard version of Oddmuse (there is no change in Oddmuse). OddmuseGit is composed of two bash scripts : one for getting cloning/updating the git repository and another script just for pushing diff between Oddmuse remote backend and a local git repository. This can be used as a basis for cloning, merging existing wikis into one, offline editing and alike. If you have more ideas or specific use, let me know.
oddmuse2git is the script fetching the Oddmuse wiki pages via HTTP and pushing the content in your local git repository (usually in the master branch).
The first time you want to work on an existing Oddmuse wiki, you'll need to clone completely the content of the wiki. The script will use the index action of Oddmuse to download all the pages. This can take sometime especially that Oddmuse is often configured to limit the number of queries per a period of time.
sh oddmuse2git.sh http://www.foo.be/cgi-bin/wiki.pl /home/foobar/data/wiki/ clone
When you have fully cloned an Oddmuse wiki, the first commit will be the complete import of the pages. Feel free to use all the standard git tools in your destination directory (in the example /home/foobar/data/wiki/).
Afterwards, you'll be able to update the wiki using the rc action from Oddmuse to only gather the update for the specified Oddmuse wiki.
sh oddmuse2git.sh http://www.foo.be/cgi-bin/wiki.pl /home/foobar/data/wiki/ update
important note: It's a good practice in git (and for OddmuseGit too) to not work on the master branch. If you know what you are doing… it's up to you.
After the initial import, you want to work locally on the wiki. The easiest is to create a local branch from the cloned Oddmuse wiki.
cd /home/foobar/data/wiki/ git checkout -b local master git branch -a
Now you can edit and commit your changes in your local branch.
If you want to publish your changes you'll use git2oddmuse.
git2oddmuse is the script comparing two branches (usually master branch against local branch) of your local git repository and pushing in HTTP the merged content back into the Oddmuse wiki.
sh git2oddmuse.sh http://www.foo.be/cgi-bin/wiki.pl /home/foobar/data/wiki/ FooBar MySecretSome
git2oddmuse.sh relies on a perl script part of Oddmuse called wikiput. This is also included in the repository.