Tags

Subversion and Core Data (Versioning)

Posted on by Nick. Posted in tools.

iOS developers often have to commit their code into a Subversion repository. Usually this a simple, straightforward process unless Core Data (versioning) is involved.

Many iPhone / iPad / Mac developers have probably seen this error message:

‘<YOUR_CORE_DATA_MODEL.xcdatamodeld’ is already under version control

What happens is that the .xcdatamodeld is actually a folder rather than a file and thus subversion creates .svn subfolders as it should. This would all be okay, until you try to create a new core data version. At that point Xcode will move this folder into another folder together with its .svn subfolders. This is a big No-No for subversion though.

Here’s how I fixed this:

  1. Copy the xcdatamodeld resource to another location (e.g. Desktop)
  2. Using your preferred svn tool (I use and recommend Versionsapp) remove the old xcdatamodeld from your repository.
  3. svn update the parent folder
  4. Open terminal and change directory to your xcdatamodeld back up.
  5. Recursively delete all .svn folders rm -fR .svn and make sure that if there are any subfolders your remove the .svn folders from there as well
  6. Copy xcdatamodeld back to where it was and issue anĀ svn add YOUR_CORE_DATA_MODEL.xcdatamodeld/
  7. You are now ready to commit the changes as per usual.

The basic idea is to remove all traces of svn from your original folder, then remove all traces of your file/folder from subversion itself and then do a new add & commit.

Cheers…

Tagged: , , , ,