snipsnap2svn

For the impatient:
Download snipsnap2svn.xslt
SnipSnap web site
Subversion web site

snipsnap2svn is an XSLT script that converts SnipSnap XML database exports into Subversion dumpfiles, with change history, so they can be imported into a Subversion repository. This allows you to use Subversion to examine your snips’ change history, experiment with alternative SnipSnap storage backends, or migrate from SnipSnap to another CMS, such as PyBlosxom.

Example usage:

$ xsltproc snipsnap2svn.xslt snipsnap_db.xml | \
  svnadmin load /path/to/repo

By default, snipsnap2svn uses / as the path separator, .snip as the default file extension for snips that don’t have one, and 100000 as the starting revision number in the Subversion dumpfile. (The revision numbers will be lowered to start at your current revision when Subversion loads them.)

You can change these settings by changing the xsl:variable elements after the xsl:transform open tag. For example, you’ll need to increase BASE-REVISION if your repository has more than 100000 revisions.

Also, note that snipsnap2svn recreates your snip hierarchy in the root directory of your repository. To load it into a subdirectory, use the --parent-dir argument to svnadmin load.

snipsnap2svn has been tested against SnipSnap 1.0b2-uttoxeter and Subversion 1.3.1, but it should work with any compatible versions.

TODO: SnipSnap attachments. They’re base64-encoded in SnipSnap’s XML dump, but they need to be converted to binary in the Subversion dump file decoder. Unfortunately, there are very few working XSLT base64 decoders. Mukul Gandhi’s is close, but it’s recursive, so files above a few KB overflow the stack. :/

snipsnap2svn is copyright 2006 Ryan Barrett, and is distributed under the GPL.

Leave a Reply

Your email address will not be published.