Xcode 3.2 SCM with SVN and Complex Project Directories

I started messing around with SCM in Xcode 3.2 using subversion and I had a minor road bump with getting SCM to see modified files outside the project directory. It turns out there's an easy solution, but it wasn't obvious.

I won't go into details on how to setup SVN or SCM for the project, so you can follow this Apple guide for Xcode3: http://developer.apple.com/mac/articles/server/subversionwithxcode3.html

Problem: I have common source that will be shared across different platforms in the source directory, above my Xcode projects directory. The default settings for SCM will look in your projects directory, but I need to look two directories up. (../../)

[caption id="attachment_523" align="aligncenter" width="432" caption="Complex Cross-platform Project Structure"][/caption]

[ad#Link Banner]

We need to modify the project settings for SCM and configure the roots.

  1. Double-click on the project name in the Groups & Files Pane and you'll get the Project Properties window.
  2. [caption id="attachment_531" align="aligncenter" width="456" caption="Project Properties"][/caption]

  3. Click on Configure Roots & SCM in the Project Properties
  4. Set the Root to point above the project directory. In my example, the source folder is located two directories above the Xcode project. I set Roots to "../../"
  5. [caption id="" align="aligncenter" width="392" caption="Project Roots & SCM Settings"][/caption]

  6. Select the SCM repository from one that was setup during the SCM configuration process. I noticed that setting the root will reset the repository, so make sure it doesn't change on you.
  7. [ad#Large Box]

  8. Double-click SCM and we should be able to see any file under SVN version control in the parent directory two levels up. I can see changes to the directories source, images, Xcode, docs, and tests.

SCM File View with All Subdirectories

More Settings

Another helpful setting is to turn on the SCM on the files view.

  • Turn on the SCM on the Editor files view: Right-click on the view bar in the file view on the right side and enable SCM. Now you can see when files have been changed in the normal view outside the SCM view.
  • [caption id="attachment_534" align="alignnone" width="459" caption="Viewing SVN File Changes"][/caption]

  • View Flat Files: If you double-click on SCM in the Groups & Files pane you will get another window. On the bottom left side there is a button. Set it to "Flat" if you like to see just the files that changed without regard to where in the SVN repository they were.
Viewing SCM with the Flat Files view

[ad#Large Box]

Using SCM with SVN 1.6 and Xcode 3.1.2

Version control software is very important to use to keep track of changes. Today I was testing out the Xcode SCM (Software Configuration Management) integrated tools with SVN today and I had a few issues.

1. Xcode is trying to use the wrong dynamic libraries for SVN, if you update your SVN version to 1.6+. Since it's referencing the wrong libraries you will get an error similar to this one:

Error: 155021 (Unsupported working copy format) please get a
newer Subversion client

I've seen this type of error when I upgraded my SVN and tried to use other SCM GUI software. To fix it I googled around and found some useful information at: Blind Genius Weblog

cd /usr/lib
sudo mkdir oldSVN
sudo mv libap*-1.dylib oldSVN
sudo mv libsvn*-1.dylib oldSVN
sudo mv libap*-1.0.dylib oldSVN
sudo mv libsvn*-1.0.dylib oldSVN
$ sudo ln -s /opt/local/lib/libap*-1.0.dylib .
$ sudo ln -s /opt/local/lib/libsvn*-1.0.dylib .
$ sudo ln -s /opt/local/lib/libap*-1.dylib .
$ sudo ln -s /opt/local/lib/libsvn*-1.dylib .

Instead of removing the library files, I moved them into a new directory as backup.

2. Now Xcode can use the correct updated libraries from SVN 1.6+, so I moved on to the next task of adding an existing project to the SVN repository. The tutorial at jms1.net was helpful in refreshing my memory for the SVN commands.

Make a project in Xcode and then use Terminal and execute the commands. If you aren't familar with SVN check out the documentation.

cd LOCAL_PROJECT_PATH
svn mkdir SVN_REPOSITORY_LOCATION/PROJECT_NAME
svn co SVN_REPOSITORY_LOCATION/PROJECT_NAME .
svn add *
svn revert --recursive build
svn ps svn:ignore build .
svn ci

The commands create a folder in your SVN repository. Next it checks out the remote repository folder into the local project folder and add all of the project files. Once the files are "added" you'll want to remove the build directory and ignore it from your SVN repository. Lastly it'll commit the changes and you're project is in the repository.

3. The project is in the repository and Xcode is using the latest version of SVN. You can use the SCM tools in Xcode to manage the project.

[ad#Large Box]