Friday, March 4, 2011

Use Subversion with Xcode

## create svn repo
svnadmin create /path/to/your/repo

## create directory in svn repo
svn mkdir -m "blah" file:///path/to/your/repo/trunk

## import project to svn repo
svn import ./YourProjectName -m "comments" file:///path/to/your/repo/trunk/YourProjectName

## checkout project
svn checkout file:///path/to/your/repo/trunk/YourProjectName /path/to/local/dir

## delete directory from repo
svn rm -m "blah" file:///path/to/your/repo/trunk/YourProjectName/dir
svn update

## add a file
svn add -m "blah" file

## delete a file
svn rm -m "blah" file

## commit change
svn commit -m "blah"

## make file executable in repo
svn propset svn:executable on file

It is suggested to remove build directory before importing Xcode project to svn. Build directory contains some binary files which are easily causing problem with svn.

Another common issue is library files are not imported into svn by the Xcode built-in SCM. When you checkout the project to a new location and try to build it, the build fails due to missing libraries. You need to add the libraries to svn by command line.