Export versions of a document (/.DocumentRevisions-V100)

automationversions

I'm trying to automate the following process:

  1. get all versions of a document,
  2. check in each version to a repository (Subversion, in my case)

As a half-solution, I'd already be happy with:

  1. get all versions of a document,
  2. name them to include a version info (an incrementing revision number, a timestamp, whatever),
  3. place them in a common directory.

However, I couldn't find any tool, command-line or otherwise, to help with this. Nor does there appear to be Automator or AppleScript support for managing versions, or, some other means of browsing the /.DocumentRevisions-V100 database for a particular document.

I only seem to be able to browse to a particular version, mark it as current, save a copy, then repeat. Is this correct? Has anyone attempted to at least speed this up with UI scripting?

Best Answer

This is not an answer, but it is too much for a comment. Might be somebody can add information here.

You might think the different versions are stored within the file itself. This is not true. The different versions are stored in the following directory

/.DocumentRevisions-V100

You need admin rights to browse around in that folder, so changing its rights using the following command makes it possible to see its contents without admin rights.

sudo chmod -R 115 /.DocumentRevisions-V100

Now you can use Finder to look around in your versions.

open /.DocumentRevisions-V100

You will notice that the directory structure is a bit un-human, and it looks a bit like the iPod structure if you ask me. The different versions of all your files are stored within this folders. Probably, the /.DocumentRevisions-V100/db-V1/db.sqlite-wal file contains the most important information. But unfortunately I can only guess how these versions are stored.

It might be possible to create a smart folder that handles the contents of /.DocumentRevisions-V100 to fetch the versions you want.

(Most of this info is from: http://www.maclife.com/article/howtos/everything_you_need_know_about_versions)

New: The /.DocumentRevisions-V100/PerUID/[0-9] directory contains the files per user ID (run the id command in the Terminal to know your user ID). This is were the different versions of all your docs are stored. When I copied this Directory to my desktop and changed permissions, I was able to do spotlight searches on them and find all versions from 1 certain file.