Question

So you know a lot of Mac apps use "bundles": It looks like a single file to your application, but it's actually a folder with many files inside.

For a version control system to handle this, it needs to:

  • check out all the files in a directory, so the app can modify them as necessary
  • at checkin,
    • commit files which have been modified
    • add new files which the application has created
    • mark as deleted files which are no longer there (since the app deleted them)
    • manage this as one atomic change

Any ideas on the best way to handle this with existing version control systems? Are any of the versioning systems more adept in this area?

Was it helpful?

Solution

For distributed SCM systems like git and mercurial shouldn't be a problem as Matthew mentioned.

If you need to use a centralized SCM like Subversion or CVS, then you can zip up (archive) your bundles before checking them into source control. This can be painful and takes an extra step. There is a good blog post about this at Tapestry Central:

Mac OS X bundles vs. Subversion

This article demonstrates a ruby script that manages the archiving for you.

OTHER TIPS

Mercurial in particular versions based on file, not directory structure. Therefore, your working tree, which is a fully-fledged repository, doesn't spit out .svn folders at each level.

It also means that a directory that is replaced, like an Application or other Bundle, will still find it's contents with particular file names under revision control. File names are monitored, not inodes or anything fancy like that!

Obviously, if a new file is added to the Bundle, you'll need to explicitly add this to your repository. Similarly, removing a file from a Bundle should be done with an 'hg rm'.

There aren't any decent Mercurial GUIs for OS X yet, but if all you do is add/commit/merge, it isn't that hard to use a command line.

An update from the future:

If I recall, the problem with managing bundles in SVN was all the .svn folders getting cleared each time you made a bundle. This shouldn't be a problem any more, now that SVN stores everything in a single .svn folder at the root.

Bringing this thread back to daylight, since the October 2013 iWork (Pages 5.0 etc.) no longer allows storing in 'flat file' (zipped), but only as bundles.

The problem is not the creation of version control hidden folders inside such structures (well, for svn it is), but as Mark says in the question: getting automatic, atomic update of files added or removed (by the application, in this case iWork) so I wouldn't need to do that manually.

Clearly, iWork and Apple are only bothered by iCloud usability. Yet I have a genuine case for storing .pages, .numbers and .keynote in a Mercurial repo. After the update, it blows everything apart. What to do?

Addendum:

Found 'hg addremove' that does the trick for me.

$ hg help addremove
hg addremove [OPTION]... [FILE]...

add all new files, delete all missing files
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top