Skip to content

xcode 4 with subversion SVN server–Tips

[gard]
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.
Website Developer SydneyTalk 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.

First Contact

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
Note:
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.

Thoughts

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!

10 thoughts on “xcode 4 with subversion SVN server–Tips”

    1. Thanks for the comment. We found this post became the most hit post on our site in one day. Guess there is a lot more interest in SVN servers than we thought. If anyone would like a hosted SVN server. Please get in contact with us. We can probably sell one of three solutions.
      1. We host a virtual SVN server for you.
      2. We sell you a configured VM SVN server.
      3. We setup a SVN server for you on your machine.
      We are loving the move form Microsoft to Apple. As hard as all this is, it is nothing to the mess you find in the bowls of a Microsoft Exchange 2007 server.

  1. I setup a collabnet svn server on an old WinXP machine using CollabNet Subversion Edge 1.3.2 (for Windows 32 bit) from http://www.open.collab.net/downloads/subversion/ (it’s really nice too, easy to setup and configure), but Xcode 4 crashes when trying to import anything to it… so it looks like the svn client in Xcode is too old for this version of subversion (I think it’s 1.6.6 inside collabnet).
    Anyhow, a total bummer, so I uninstalled it and installed an older version from collabnet ( http://www.open.collab.net/downloads/subversion/svn1.5.html ) from a link on the same page for older collabnet versions. This 1.5 version almost works… no bells and whistles like the Edge version mentioned above, this is a plain old svn server process. I’m still working on trying to get Xcode working with it. At least it no longer crashes, but now complains it cannot “find” the repository when I try to configure the trunk,tags, and branches. Hopefully, I will get it going tomorrow (today).
    If I get it working, I’ll post details. Good luck…
    scott
    Fr

    1. It actually it sounds like something else causing the problems. From what we figure, you should be able to connect to lat version of SVN with xCode, but you will still need to follow our instructions when making a connection. We too were able to make xCode crash when we did not connect correctly. But when we got it correct, it hummed.
      Our SVN server is setup on a Ubuntu server, and as I am turning from a Windows server administrator to someone who hates anything Windows. It was probably your XP machine… Let’s blame Bill

  2. I think the main reason everyone is so interested in SVN now, like me, is that Xcode no longer supports CVS… that client has been removed from Xcode all together. Therefore, forcing people to SVN or GIT, because most developers like the source code client inside the IDE. Now that CVS is gone (even though its very old, its also reliable and used by millions of people still) from Xcode, its now time to upgrade to another more well support Xcode SCM (like SVN or GIT).
    Thanks for your comments, I’m actually going back to the 1.6.6 svn version and trying your steps to workaround the crashing issue. I’ll post my results shortly.

  3. Okay great news!!! Thanks for the suggestions above that 1.6.16 should work with Xcode4, you are absolutely correct. I went back to the first setup I described in my first comment and then followed your steps… with some slight modifications to get it working. In the end, my configuration varies only slightly from yours so I’ll try to outline exactly what I did so this may help others.
    (1) Setup an SVN server (I used the latest 1.6.16 svn server). Make sure you know the authentication username and password and protocol (svn or http) access method. Create the project repository, for this example our project svn repository name is “helloworld”.
    (2) Open Xcode and select File->Source Code->Repositories
    (3) Bottom left, click the + to “Add Repository”
    (4) Add the details of the SVN server.
    Like this: svn://www.servername.com/svn/helloworld
    In my case, I used collabnet and defaults to http access, so I used
    http://www.servername.com/svn/helloworld
    (5) Where asked for Trunk Branches and Tags (leave empty for now).
    (6) Click “Add” to complete the repository addition (we will come back to finish step 5 later)
    (7) Now we need to use the “Terminal” program to make a connection to SVN.
    (8) Open a terminal and create a test.txt file with some simple message in it.
    (9) I tried to use “svn://www.servername.com/svn/helloworld/trunk” first, and I kept getting “connection refused”.
    The problem was I needed to use “http” not “svn” for the protocol (either should work, but the host firewall was blocking “svn” protocol).
    I then tried “svn import ./test.txt http://www.servername.com/svn/helloworld/trunk -m “initial import” –username yourname
    You should be prompted for a password, enter your svn password.
    The idea is that we are uploading a single file to establish a connection.
    You will likely see something that says. “http://www.servername.com/svn/helloworld/trunk already exists” – Ignore that!
    (10) Close Xcode
    (11) Open Xcode again and return to “File->Source Control->Repositories” and click on your SVN server and enter your tags,branches,trunk directories simply:
    tags
    branches
    trunk
    For me… as soon as I did this it opened a dialog window asking for my SVN username and password. I entered my username and password and submit. The lights next to each trunk,tags,branches idicator turns red… then went to GREEN!
    Now, click on the “trunk” and at the bottom of the window click the “Import” button to import your source code into the trunk. (Select your source FOLDER and it will import everything).
    NOTE: I did not get ANY feedback that it was actually doing it… but I did not get any error messages or anything. After a couple minutes… voila, the files were imported! Now, you can CHECKOUT your project… do it, test that you can modify a file and commit it… you will see the “M” indicator next to your class file after you make an edit and save. Then right-click on it and “Commit” it to the repository!
    I hoped this all helped… Thanks to the originator of this blog! My Xcode 4 is working great now with my SVN repository.
    PS: I’ve added other project SVN repositories now… you can skip all the steps above on subsequent svn projects from the same svn server.
    cheers
    scott

  4. Pingback: InteractiveWebs Blog » xCode 4 and SVN subversion server IP address change

Leave a Reply to InteractiveWebs Cancel reply

Your email address will not be published. Required fields are marked *