2

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?

  • What is the definition of a 'version'? Isn't a new 'version' stored with every keystroke? – CousinCocaine Jan 11 '15 at 8:04
  • No — if that were the case, the Versions browsing UI (File → Revert To → Browse All Versions…) would be impossible to use. Versions are fairly fine-grained, but not that extremely. – Sören Kuklau Jan 11 '15 at 17:06
1

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.

  • Right, I do know about the two SQLite databases (.sqlite-wal files, by the way, are transactional logs; the "real data" is in the files next to them, in this case /.DocumentRevisions-V100/db-V1/db.sqlite and /.DocumentRevisions-V100/.cs/ChunkStoreDatabase). I was hoping someone got far enough in figuring them out to provide a UI. – Sören Kuklau Jan 11 '15 at 17:10
  • Using a smart folder on /.DocumentRevisions-V100 to is unlikely to work, as previous versions aren't always stored in complete files, but instead frequently as chunks (kind of like incremental backup). – Sören Kuklau Jan 11 '15 at 17:10
  • When I copy the DocumentsRevisions-V100 folder to my Desktop, I can search using spotlight and find whole files. But I still no clue how it is organised. But as I said, this answer is not an answer. – CousinCocaine Jan 11 '15 at 18:03
1

the 'NSFileVersion' API can do what you want but it requires programming experience

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .