Creating a Versioned Core Data Model Under Subversion

Recently, I tried to create a versioned data model for an application I had created earlier this year and had some issues with Subversion not being able to commit the changes.

When xcode creates a new versioned data model, the existing data model essentially gets moved into a .zip file format consisting of the current version (named the same as the un-versioned model) and any older versions that might be there named with sequential numbers appended to the name (only 1 in the beginning).

The problem with svn occurs because apparently the svn integration in xcode 3.2.x doesn’t perform a move into the .zip. Therefore, when you try to commit the code, svn will complain that the new data model within the .zip has the same name as an already existing file.

The workaround I implemented is to go to finder and duplicate the model before versioning it. Then switch back to xcode and create the versioned data model. Afterwards, rename the duplicated file back to the original data model file name. If you look at the file system in finder, you should see both the newly created version data model and the old data model.

Now expand the versioned data model and delete the file of the same the name as the original data model inside. Afterwards perform an svn move of the un-versioned data model to inside the versioned data model. Now you can commit the changes without an issue and everything will work fine.

Hopefully xcode 4 will fix this because it caused me a little pain before I figured out how to workaround the issue.

Comments

One Response to “Creating a Versioned Core Data Model Under Subversion”

  1. Darren Stokes on October 10th, 2010 10:59 am

    I forgot to add in the main post that if you are using the latest templates when you generate your project, you won’t have this issue because the templates generate a versioned data model file with only one model in it. This change was probably made because of this issue but that is just a guess.

    I’m not sure exactly when the templates were changed in xcode.