2007-07-16

Restore .svn in Keynote/Pages documents

Subversion stores its metadata in a directory called ".svn" that lies in every directory under version control. Keynote, Pages, and some other applications on Mac OS X store their documents in directories that look like files in the Finder. However, for Subversion they are normal directories and as such contain a ".svn" when under Subversion control.

Unfortunately, Keynote/Pages delete the ".svn" metadata-directories when a document is saved. This breaks Subversion: on the next commit or update you get the error "containing working copy admin area is missing". This bug is known since years but has not been fixed.

As a workaround, I've written a shellscript that restores the deleted ".svn" files. You can download it here.


Update 2008-09-16: I fixed a bug that could lead to the deletion of all contents of folders with extended privileges.

Update 2008-04-09: I created an Automator workflow so that the .svn folder recovery can be started from a document's context menu in Finder.

Update 2008-04-09: I improved error handling when the document is not under version control or has been an ordinary file before.

Update 2008-02-19: I incorporated the improvements from the comments. Thank you!