Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Subversion in Xcode

Tags:

It seems that all of the initial Google results for "using subversion with xcode" are actually just tutorials for installing and configuring svn and Xcode, as opposed to actually using the two (i.e. interacting with svn via Xcode's GUI).

Is anyone aware of a good guide that teaches the tricks and pitfalls of working with svn via Xcode's GUI? Something that bridges the gap between the most excellent Version Control with Subversion book and the Xcode IDE (as in pure Xcode GUI without any terminal command use)?

Edit:

We all love our terminal commands, and we all love Eclipse but (and I mean this in the nicest possible way) neither is really the point of the question. I’d prefer to use svn via Xcode’s IDE instead of via terminal just as I prefer (well, for this case) to code in Xcode’s IDE instead of using vim and gcc. Apple engineers spent a good bit of time implementing that SCM menu in Xcode; someone has to have seen a usage guide somewhere.

like image 374
Kevin L. Avatar asked Oct 11 '09 21:10

Kevin L.


People also ask

Does Xcode have SVN?

Xcode 10 doesn't support SVN (Subversion)

How do I commit a SVN code in Xcode?

Note, to get SVN integration with Xcode working, you should open Xcode -> Preferences -> Accounts tab and add your SVN account there (+ button in the bottom left corner -> Add Repository). Hope this helps.

Can we use SVN on Mac?

svn can not be used in MacOS Big Sur 11.0.


2 Answers

I used this page as a reference for setting up my XCode projects with SVN. It is a good starting point, but I'll give a short walkthrough of what I did (since the page isn't really all that helpful!).

A couple notes: I'm using XCode 3.1.2 and Subversion 1.4.2. I've heard of problems with using SVN 1.5, but there are ways around that which I wont get into.

First off, I had a repository already set up and created the XCode project afterwards.

  1. In XCode you need to set it up to know about your repository using the SCM tab in the preferences window. Enter:

    1. A Name (this is arbitrary and used for reference with XCode)
    2. The scheme (http or svn)
    3. The host (i.e. svn.example.com)
    4. The path (the exact path to the SVN repository located on the host)
    5. The port (only if it isn't the default)
    6. And a username and password used to access the repository.

    The URL will be auto-filled as you enter the other fields. Hit "OK" when all the fields are good and XCode says it can connect.

  2. Then open your project and do a "Get Info" (Round blue icon with an exclamation mark) on the project itself. Under the "General" tab down at the bottom is an option for SCM, select the repository you made in 1 and close the window.

  3. Now open SCM in the menu-bar and go to "Repositories." Hopefully you've built your repository right using branches, trunk, and other directories at the base level because XCode doesn't have support for checking out the root directory. So go one directory at a time down the list and click the "Checkout" button and select a directory to check it out to (I recommend a "Code" or "Source" or "SVN" directory inside your XCode project directory). You cannot checkout multiple directories at once, but you can tell the next directory to checkout before the first has finished and XCode with queue the commands.

  4. Once that is all done go back to your XCode project window and "Add -> Existing Files..." to your project. Select the directory you've checked out the repository to and I recommend using the "Create folder references" option instead of the "Recursively create groups" option because added and removed items will be automatically reflected in a Folder Reference but not in a Group.

Now you've imported your SVN repository into an XCode project. From here any time you make a change, simply Right-Click (Control-Click if you only have 1 button) in the file and at the bottom of the context menu are the SCM options for comparing, committing, updating, and discarding (reverting) the file. You can also use the SCM menu in the menubar for file or project-wide updates/commits/reverts.

like image 200
Oz. Avatar answered Oct 24 '22 06:10

Oz.


I second the comment by the_mandrill, SVN support from within XCode is very limited, especially if you're used to Eclipse.

I also don't understand why everyone seems to need visual clients. I keep a terminal window open on my project directory and I have no problems interacting with SVN from the command line.

like image 39
ruipacheco Avatar answered Oct 24 '22 05:10

ruipacheco