I know .xcdatamodel is actually a directory with two files (elements
and layout
).
I know the two files are binary plists, and can convert them to XML plists with plutil -convert xml1
(while relying on this may be "unwise", it's perfectly fine for development: I expect that the build tools will compile/optimise/whatever when putting them on device, and assuming Xcode doesn't lose the ability to read old files, I can always convert them back to binary1
).
My two problems:
- Xcode modifies both files if you so much as move an entity (I would've expected that to just change
layout
), which is entirely unhelpful with multiple developers. - There appears to be no easy way to merge changes (even the XML plist format is an NSKeyedArchiver-serialized object graph, so a textual merge wouldn't work).
- There appears to be no easy way to see what's changed (maybe I could convert them both to XML and do a diff... ugh).
Has anyone found a solution to any of these? Can I force Xcode to save as XML plists, or force Subversion to convert them to XML plists on commit? Is the diff even vaguely sensible? Is there an external tool that performs an .xcdatamodel diff?
EDIT: SCM-based locking doesn't really solve the problem any more than saying "I'm about to edit X"; the danger is that someone forgets to lock, makes a change, updates, and everything breaks. The svn:needs-lock
property ought to work, but unfortunately Xcode doesn't respect chmod -w
on elements
or layout
(an unwritable .xcdatamodel doesn't work either, even though Xcode shows the lock icon, and svn additionally fails).