Tuesday, September 26, 2006

SVN-Savvy

There is something I find a bit annoying about MacOSX.

I am a heavy user of Subversion repositories, for versioning my own work, and work I do in collaboration with other people, we could not work without it. When you add a folder to SVN, a hidden folder called '.svn' containing metadata is automatically added. This normally causes no problems ....... until that is you try to keep something like a presentation made my Keynote.app in there.

When Apple moved from OS9 to OSX, a replacement was needed for Resource Forks. Apple came up with a solution called Bundles. Applications in MacOSX are Bundles, so are many native file-types for Apple's built-in Apps. Bundles are actually folders with more folders and files inside. If you make a document in TextEdit.app and add an image to it, the image is stored in the Bundle. The Finder is written to treat Bundles like a single file, so that is the way they seem to behave.

When an application saves a Bundle, it writes everything out to a temporary folder, deletes the original, the renames the temporary. That all sounds like a fine approach, until you consider that the file may have been added to SVN, in which case all of the '.svn' folders are now missing, and of course SVN freaks!! The Bundle framework, or whatever the code is that is doing this, was written with the assumption that nothing would legitimately write it's own files into a Bundle, which normally would be reasonable.

Considering that SVN is built-in to Tiger, is included with Apple's developer tools like XCode ...... you'd have thought someone at Apple would have clicked by now ...... it cannot be too difficult to make their code SVN-savvy. OK, so if they don't want to have to muck about moving the '.svn' folders around, they could have to option to keep Bundles TAR'd.

MacOSX is a great platform, there is nothing I'd rather use for my work ...... but it is far from perfect .....

2 comments:

metal said...

useful information blog,very good content.

Hadley Wickham said...

You can use the follow bash script that to fix svn directories borked by apple apps:

svnfix() {
dir=presentation.key
mv $1 "$1-backup"
svn up $1
rsync -arC "$1-backup/" $1/
svn add --force $1
rm -rf $1-backup
}

Usage:
svnfix name-of-my-presentation.key
(note that there's no trailing /)