Setting Up Subversion for Flex on Leopard

Up until fairly recently I’ve used Windows as my development platform, but OS X won me over and now I’m in the Apple camp. My past experience with Unix is limited, so when I wanted to add Subversion to my Mac as a version control system for Flex I discovered that I was going to have to do a bit of research.

When I started digging around for information about installing Subversion on a Macintosh I found that Apple had thoughtfully integrated Subversion into the base installation of Leopard (there’s no need to install the developer tools). With the Subversion installation already loaded the next question became “What do I need to do to use it?”

After spending some time with Google, I discovered a document by a developer at Sonza that describes how to configure Subversion on Leopard. The article goes into greater detail than is required if all you want is a simple Subversion set up, so I’ve extracted the relevant steps and included information on installing Subclipse for Eclipse. If you are interested in a more robust Subversion installation, I suggest that you take a look at the original document.

If you’re ready to get started, open up a Terminal window and follow along.

Before we start typing let me mention that I had some permissions issues that required me to deviate from the Sonza document. Since these issues were identical on two different Macs (one of which had a clean install of Leopard), I’ve documented the steps that I used to successfully get Subversion working. Because of the changes you will occasionally be told that you must enter your password when executing a command.

Also, note that I am using Eclipse 3.3.2 with the Flex Builder 3 plug-in running on OS X 10.5.2. While I believe these instructions should work for other configurations, I’ve only tested it with this particular configuration.

1) Create a Subversion repository

Type the following commands in an open Terminal window:

cd /usr/local
sudo svnadmin create repository

2) Create the basic structure and commit changes to the repository

In Terminal, enter the following:

cd /tmp
svn co file:///usr/local/repository
cd repository
svn mkdir tags branches trunk
sudo svn ci -m 'initial structure'

3) Configure Apache

For this step you’ll need to create a file. To do this we’ll use a simple text editor named “nano”.

In the Terminal window type the following:

cd /etc/apache2/extra
sudo nano httpd-subversion.conf

When nano opens, paste the following text into the window (the right portion of the text below might be clipped in your browser so make sure to check it by comparing it to the screenshot):

LoadModule dav_svn_module   libexec/apache2/mod_dav_svn.so
LoadModule authz_svn_module libexec/apache2/mod_authz_svn.so

<Location /repository>
   DAV svn
   SVNPath /usr/local/repository
</Location>

Here’s what the Terminal window should look like:

httpd-subversion.conf

Now type Ctrl-X in the Terminal window and then type “Y” when asked if you would like to save the modified buffer.

Next you’ll need to make a change to the Apache configuration file. Once again in Terminal enter the following:

cd /etc/apache2/
sudo nano httpd.conf

We are back in nano with the Apache configuration file loaded. Page down using Ctrl-V until you find a section named “Secure (SSL/TLS) connections” (it should be at or near the bottom of the file). After this section enter the following:

# Subversion
Include /private/etc/apache2/extra/httpd-subversion.conf

Here is a screenshot of the Terminal window to give you an idea of what it should look like after entering the text:

httpd.conf

Exit nano by typing Ctrl-X and entering “Y” when asked if you would like to save the modified buffer.

4) Re-start (or Start) the Apache Web Server

Open “System Preferences” and select the “Sharing” option from the “Internet & Network” section. If “Web Sharing” is checked, click the checkbox to turn Web Sharing off and then click the checkbox again to start Web Sharing. If Web Sharing was not checked, click the checkbox to enable Web Sharing. Close the System Preferences and open a web browser.

In a browser enter http://localhost/repository and you should see a page listing the three directories that were created above (tags, branches and trunk).

Congratulations! Subversion is working!

5) Change Repository Permissions

There is another change that needs to be made using Terminal before moving on to configuring Eclipse.

Because of Leopard’s default permissions, errors occur when Subclipse attempts to create versioning files in Eclipse. The only way that I could eliminate the permissions errors was to change the permissions so that all users have read and write access to the repository files. If you are on a Macintosh that is shared or if you are concerned about the security of your source code, then you might not want to change permissions for the repository as it will allow anyone to change or delete the repository files; however, if you don’t make the permissions changes then Subclipse probably will not work.

In Terminal, enter the following:

cd /usr/local
sudo chmod -R 777 repository

6) Installing Subclipse

The next task is to install Subclipse in Eclipse so that Subversion can be used to version files in Flex projects.

• Start Eclipse (or Flex Builder) and from the “Help” menu select “Software Updates” -> “Find and Install…”.

• Select the option that says “Search for new features to install” and click the “Finish” button.

• In the “Install” dialog window, click the “New Remote Site” button to display the “New Update Site” dialog and enter “Subclipse” for the name and “http://subclipse.tigris.org/update_1.2.x” for the URL.

• Click the “OK” button to close the “New Update Site” dialog, then make sure that the new “Subclipse” entry has a check mark next to it and click the “Finish” button.

• The “Updates” dialog window will now be displayed. Click the disclosure triangle next to the “Subclipse” entry to display the Subclipse features list. From the list, select the “Subclipse Plugin” option. Depending on your Eclipse installation, selecting the checkbox for the optional integrations may not allow Subclipse to be installed, so only select the optional integrations if you are sure that you need them.

• Click the “Next” button, read and accept the terms of the License Agreement (if you agree), and then click the “Next” button again. Click the “Finish” button and the Update Manager will download the Subclipse plug-in and begin the installation.

• When the “Feature Verification” window is displayed, click the “Install All” button and then select the option to restart Eclipse when prompted.

6) Adding a Flex Project to Version Control

Follow these steps to add a Flex project to version control:

• Right-click (or Ctrl-Click) on the project in the “Flex Navigator” panel and select “Team” -> “Share Project…”

• Select the “SVN” option as the repository type and click the “Next” button

• Leave the “Use existing repository location” selected (it should show “http://localhost/repository“) and click the “Next” button again.

• Keep the default “Use project name as folder name” option selected and click the “Finish” button.

• You will now be presented with a dialog window that allows you to specify a comment for the initial commit and that allows you select what files you would initially like to place under version control. Make your selections and click the “OK” button.

Your Flex project is now under version control. To access version control for any file or resource listed in the “Flex Navigator” panel, right-click (or Ctrl-Click) on the item in the tree and select the “Team” menu item to access a sub-menu with version control options for that item.

RESOURCES

Installing a Subversion Server on Leopard
Version Control with Subversion
Subversion
Subclipse
Subclipse Documentation

Published in: on March 3, 2008 at 8:41 am Comments (7)
Tags: , , , , ,

The URI to TrackBack this entry is: http://blog.mediablur.com/2008/03/03/setting-up-subversion-for-flex-on-leopard/trackback/

RSS feed for comments on this post.

7 Comments Leave a comment.

  1. are you able to commit your deploy folder without errors?

    https://bugs.adobe.com/jira/browse/FB-11583

  2. I get the same error message as documented in the bug report that you referenced (according to Adobe this is an Eclipse bug). It’s not an issue for me because I don’t put build directories under version control. I use version control strictly for the source (I can always go back and re-create a build if I have the source).

    By the way, while I did get an error message when I added the build directory to version control I didn’t see any corruption. Perhaps that’s because I don’t have the entire project under version control (as I mentioned, I only add source to version control).

  3. My life’s problems have been mostly solved with Subversive. This allows you to commit the entire project including deploy folders

    http://www.eclipse.org/subversive/index.php

  4. Hello,

    I got an error when I try to run this command in the terminal…

    sudo svn ci -m initial structure

    I’m using Leopard

    Here is what I did:

    Last login: Mon Jul 28 20:10:24 on console
    macbook-pro-de-francois-m:~ francois$ cd /tmp
    macbook-pro-de-francois-m:tmp francois$ svn co file:///usr/local/repository
    Checked out revision 0.
    macbook-pro-de-francois-m:tmp francois$ cd repository
    macbook-pro-de-francois-m:repository francois$ sudo svn ci -m initial structure
    Password:
    svn: Commit failed (details follow):
    svn: ‘/private/tmp/repository/structure’ is not under version control
    macbook-pro-de-francois-m:repository francois$

    Any idea/help ? Please!

    When I visit http://localhost/repository/

    I have this text in my browser…

    Revision 0: /

    Powered by Subversion version 1.4.4 (r25188).

    I don’t see the 3 folders but in the terminal I can see them if I do a ls.

    Thank you for your help!

  5. Unfortunately I’m not an expert in SVN and I didn’t run into the problem that you described, so I don’t know off-hand what might cause the problem.

    At the bottom of the post I’ve listed some links to resources that I used to get things set up so you might want to explore those resources.

    Good luck! Sorry I don’t have the answer for you :-(

  6. Hi,

    Many thanks for the walkthrough – I’ve now got subclipse + svn working on Leopard! I ran into a couple of problems:

    The svn: ‘/private/tmp/repository/structure’ is not under version control error Francois hit can be fixed by changing the final command in step 2 from

    sudo svn ci -m initial structure

    to

    sudo svn ci -m ‘initial structure’ (with quotes around the inital structure string)

    Also, there is an updated version of subclipse available, 1.4 – however I found that this did not work, and after some googling it turns out that 1.2 ‘http://subclipse.tigris.org/update_1.2.x’ (as listed above) works fine.

  7. Thanks Fred for pointing out the problem with “initial structure” in step 2 — I’ve updated the instructions in the post.


Leave a Comment