I've been doing a lot of development in XCode lately and had to brute force my way through the learning process of how to start running my own Subversion repository at home. It seems so easy at work...you just point Tortoise to this magical repository that already exists and voila, source control! At home it can be a bit more tricky. Fear not. I took copious notes on the process and have decided to be kind and save others from similar grief. Plus, this post will also serve as a nice memory jogger for me if I ever have to set this all up again.
Step 1
Open up Terminal.app and type "svnadmin create /Users/chris/SVN" at the prompt.
Needless to say, choose your own directory of course, in the likely event you don't share my name. If you were to navigate to this directory after executing the command above, you'll notice that svnadmin has essentially setup an entire folder structure that SVN will use to maintain your repositories.
Step 2
Head to the following "XCode.app -> SCM -> Configure Repositories"
Name: Home
URL: file:///Users/chris/SVN
Scheme: file
Host: [blank]
Path: /Users/chris/SVN
Port: [blank]
User: [blank]
Password: [blank]
Step 3
Using finder, go to the project folder that you want to import into your SVN repository. Delete the "build" directory if it is within the project folder, as we do not want to keep track of this folder within SVN. If we fail to do this, we will get all sorts of lovely errors within XCode when we try to do anything with our repository and local code.
Step 4
Return to your "SCM -> Repositories" window. Select "import" and select your project folder. Once this is done, delete the original folder from your finder window and perform a "checkout" from the repository window. This effectively grabs the code you just imported plus it sets up the .svn hidden folders that SVN needs.
Step 5
Open up your project within XCode. Head to the "SCM -> Configure SCM for this project" menu.
Project Format: XCode 3.1 compatible
Base SDK: Current Mac OS
SCM Repository: Home (Subversion) - Recommended
At this point, you should be all set! Any changes that you make will have an "M" appear next to the file within XCode. When you've finished making changes to a file, simply go to the "SCM -> Commit entire project" menu and provide a comment.
If at any point you want to make a file backup of your project to an external hard drive (if for example you're using your own local machine as I am for your SVN repository), then you can use the "export" feature within the "Xcode.app -> SCM -> Repositories" menu and dump your code to wherever you choose. You'll notice that the export feature does not include the ".svn" folders which is exactly what you want, just the raw source code with no SVN-related goodies!
Cheers,
Chris
Anime: History's Strongest Disciple Kenichi (Finished)
-
There are a few diamonds in the rough out there, and this anime is one of
them. Above and beyond the great voice acting and art direction lies a story
with...
2 weeks ago
3 comments:
For my own purposes, I don't like having the build directories checked into the source repository and the default in Xcode is to put the build products in the project directory.
In the Xcode preferences, however, you can make all builds point to another location, I created a Temp directory in my home directory for that (which I also excluded from Time Machine).
Hey Eric,
Yeah I saw that configuration option as well. Your practice definitely makes sense. I may migrate over to that method in the future, but for the time being, so long as I don't forget to remove the build folder before the initial repository import, it doesn't really get in my way in terms of SVN-interaction.
Thanks for the help! I had my build directory in my commit and had no end of problems trying to commit my entire project. Now it has been removed it works like a charm!
As Eric did, I changed my default build location to a temp directory!
Tag
Post a Comment