Last Ray of Hope Home of Kaluriel Hargrove

16Apr/09Off

XCode 3.1.3 Source Control (SVN)

Now goto the "SCM" menu again, but this time select "Repositories".

XCode - Selecting Folder to ImportSelect your repository from the left pane if you haven't already and click the "Import" button at the top of the dialog. This will allow us to transfer the initial project we require to be source controlled to our SVN repository.

Once selected, it will bring up the MacOSX file browse dialog for you to locate the folder that contains your .xcodeproj file, and if you want give a description so you know what this revision is about. After selecting the folder, click "Import".

XCode - Import SuccessfulDepending on the size of your folder and your upload speed, it may take some time for it to be uploaded to the SVN repository, but once done, a pop-up message box will appear telling you that the import was completed.

Now that the project is on the SVN repository, we need to check it out (which unfortunately means downloading it again). Click the "Checkout" button at the top of the dialog.

XCode - Selecting Checkout FolderThe MacOSX file browse dialog will be brought up again, this time it wants you to select a destination for the project to be downloaded to.

I have a specific folder I use for SVN related things that I called "Sandbox". Find the folder, or create, where you want it to be and click "Checkout".

XCode - Checkout CompleteWhen download is successful another pop-up message box will appear, this time telling you that Checkout is complete and do you want to open up the project.

Choose the "Open" option to open up the downloaded project, we still need to configure it. You can select "Don't Open" but at some point the next steps will still need to be done to it.

XCode - Setup ProjectWith your SVN project now open, we need to set it up to be attached to the SVN repository we want to use it with (so we can commit changes, update it to the latest from the server, or revert to an earlier version).

To do this, right click on the project in the left hand plane, and select "Get Info" from the list of options.

XCode - Selecting Repository for ProjectA dialog to configure the project will be brought up, at the bottom is a drop-down box with the tag "SCM Repository:" which is set to "None" at the moment. Change this to "CocoaGL (Subversion)" or whatever you called your repository when we set it up in XCode.

Close this popup dialog, and your project will connect to the repository.

XCode - Making a sourcecode changeWe are now done. The next steps are just to test to see if the connection is working properly by committing a revision.

First of all, within your code, find something to change, or add some additional code, I've added code to output a timestamped string to the debug console whenever a key is pressed or released.

XCode - Commit the changeNow goto the "SCM" menu and select "Commit Entire Project...". This will commit all changes to the current project to the SVN repository.

A small pop-up dialog will appear asking you to enter a description for the revision you are submitting. Enter one if you want, if you are new to SVN you'll find it useful for even the smallest revisions if you do give a description.

XCode - Changes made with CommitNow click "Commit" and it will begin to update the SVN repository with your changes and new files if you have any.

Hopefully there will be no errors, before I imported my projects first I use to get errors such as "Not a working copy". Now all we need to do is check the list of revisions to see if our latest revision is amongst them.

Goto the "SCM" menu and select "Get SCM Info" from the list of options this time.

XCode - Our Change is CommittedThis will retrieve a list of all revisions committed to the SVN repository, with their descriptions and a list of what files were changed. You can also diff the changes to your local files to see what is different.

If this is a brand new server, the list will be short, two if you've followed my guide correctly. And the top revision should be the one we just committed (unless it is still uploading).

XCode - Changed or New FilesAnd thats it, you don't need to commit the entire project if your changes are small and localised in one file. In the left plane with the file list, files with changes will have a character before them to signify if they are changed or new (See the image to the left).

If you right click on them, and select "Commit Changes..." or "Add to Repository" in the case of new files, you can submit them individual as revisions. You can also view and submit changes by going to the "SCM" menu again and selecting "SCM Results".

That is all for source control in XCode for the moment, I'll make another entry if I find something new about it in XCode.

Tagged as: , , , Comments Off
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.