Using Subversion with Eclipse at BSU
This page provides a tutorial on how to use Subversion (svn) and Eclipse in the BSU Computer Science Department.
Setting up a repository
Your first step is to set up a repository where your files will be kept. The subversion server is bsu-cs.bsu.edu. It is recommended that you use ssh to connect to bsu-cs.
Once you have connected, create a directory called svn off of your home directory. Technically, you can put this anywhere, but my example will assume that you have put it here. Go into this directory and run this command to initialize your repository:
This will create the repository in your svn directory using the default settings. If you look into the directory, you should see several new subdirectories and files have been created.
Setting up Subclipse
Subclipse is a Subversion plugin for Eclipse. You should install it using the instructions on the Web.
Depending on your platform and system configuration, the default configuration of Subversion may not work since it will try to use some native libraries. I recommend configuring Subclipse to use the pure Java implementation, which is completely portable. To do this, open your Eclipse preferences (Window->Preferences) and select Team and then SVN. On this page, there is a section called "SVN interface"; select the Pure Java implementation, SVNKit.
Connect to the repository using Subclipse
Once Subclipse is installed, you can open the "SVN Repository Exploring" perspective in Eclipse. This can be accessed through the Window menu, under "Open Perspective"->"Other...". Right-click in the leftmost panel and select "New..."->"Repository location". The URL for your repository is svn+ssh://bsu-cs.bsu.edu/HOME/svn, where HOME is your home directory. Once you authenticate yourself (which is done securely over ssh), you should see the repository in the left panel.
Importing a project into the repository
First, it is useful to understand the recommended repository structure under subversion.
...the Subversion community recommends that you choose a repository location for each project root — the top-most directory which contains data related to that project — and then create three subdirectories beneath that root: trunk, meaning the directory under which the main project development occurs; branches, which is a directory in which to create various named branches of the main development line; and tags, which is a directory of branches that are created, and perhaps destroyed, but never changed.
In Eclipse, right-click on the project you wish to import into the repository and select "Team"->"Share Project...". Choose "SVN" as the repository type. Then, select the repository you have just created.
When prompted for the folder name, do not use the default option. Instead, select "Use specified folder name" and enter ProjectName/trunk, where ProjectName is the name of your project. This will create a project in the repository as well as a trunk directory, and your project will be imported into the trunk.
Congratulations, you have a project stored in a Subversion repository! You can now make changes locally, commit changes to the repository, roll back changes, and even branch and tag. If you are the only developer, there are no more steps. However, if you have a team that must access the repository, you have to keep reading.
Dealing with Multiple Developers
First, you will need to request a UNIX group for your development team. Send the request to Mary Meadows' Office, and be sure to include the names and usernames of each member.
For the sake of example, we will consider a team comprised of trogdor, homsar, and marzipan, and the group will be called dumples. Assume that trogdor is the group leader (naturally) and that he has created the subversion repository in his home directory as /users/trogdor/svn.
Modifying the permissions
First, change the permissions of all files in the repository so that they are part of the dumples group. From trogdor's home directory, he enters the following command:
Next, the read and write permissions must be properly set for each file in the repository. Examine each of the files and folders in the repository, see what permissions the owner has, and copy them into the group permissions. The UNIX-savvy trogdor does this by first updating the permissions on his repository:
He then changes to the repository's directory...
and updates the permissions within the repository as follows:
In this configuration, each member of the dumples group has complete read-and-write access to the repository.