As newly anointed Xcode developers, and now with the release of Xcode 4. We found our team working on trying to get connected to a new subversion (svn) server at the same time we were trying to discover some new features of Xcode 4.
Talk about challenging.
Actually this was the first time with anything Apple we have not had a great experience. Loads of talk etc on the net about what a pain in the bum it all is.
For those who don’t know. Subversion is a code storage system that allows check in / check out of developer Xcode to a server. There are services online that you can pay monthly to for the use of a SVN server. We wanted to host it on one of our own servers.
The setup was not easy and required the setup of a new Linux server, then the setup of the SVN code to turn it into an SVN server.
What became confusing was when we needed to get Xcode to talk to the darn thing. Here is the important things you need to know.
Just like the movie from when I was a kid, “First encounter” is a big deal! Big enough to heap your mashed potato into a big mountain!
1. Open Xcode and select Window / Organiser.
2. Select Repositories
3. Bottom left, click the +
4. Add the details of the SVN server. Like this: svn://www.servername.com/directory (this should be the details for your SVN Server).
5. Where asked for Trunk Branches and Tags (leave empty for now).
Now we nee to use the “Terminal” program to make a connection to SVN.
1. Create a test.txt file with some simple message in it. Save it in your documents folder on your mac.
2. Open Terminal
3. Type “svn import /Users/yourname/Documnets/test.txt svn://www.servername.com/directory -m “initial import” –username yourname
the path “/Users/yourname/Documnets/test.txt” should be a path to any single dummy test.txt file. The idea is that we are uploading a single file to establish a connection.
The: svn://www.servername.com/directory is the path to your SVN server
“initial import” is only a tag line. Not needed
–username yourname = This is your SVN user name. Ensure you use a double dash —username.
EG: our code looks like this:
svn import /Users/spascoe/Documents/Temp/test.txt svn://www.interactivewebs.com/interactivewebs -m “test import”
4. You will be prompted with your existing user for your user password. At this point, if your mac user name does not match the configured SVN user name. Just hit enter. It will then prompt of a user. Type the new SVN user name, then enter. Then the configured SVN pass and enter.
5. You will likely see something that says. “svn://www.servername.com/directory already exists” – Ignore that!
6. Close Xcode
7. Open Xcode again and return to the Optimizer / Repositories and with luck, your server will list on the left hand side, and show the ROOT and any folders on the SVN server.
8. Click back on the server name in the left hand column.
9. Type in the names of the Trunk Branches and Tags folders. We chose to use these names to make it easy. They need to be setup on the SVN server by the administrator. They ARE case sensitive.
10. The text.txt file can be deleted from the server through Xcode if desired.
11. Close the terminal session.
Sometimes not all views refresh correctly. We suggest closing Xcode and opening it again to get things visible that you know should be there.
If you need to change user names, and or passwords. Then you will need to enter the terminal again and upload something using the method above.
We don’t understand exactly why, but it appears that Xcode will remember the authentication of the terminal session, and caches the authentication properties some place. Without the terminal session upload, you will never get it working!