SVN Information and HOWTO

 

Eclipse plug-in installation

Follow the installation guideline at the following URL:

http://subclipse.tigris.org/install.html

 

SVN General Information

SVN allows a group of people to store their code in one central location.  This is very useful in large projects, because often times different people work on different files.

 

To start with SVN, one person in the group needs to initialize a repository, which is a folder on some remote server where code will reside.  The HOWTO below gives more details on how to do this.

 

Once a SVN repository is setup, people in a group can start adding and editing files in the repository.  SVN works in the following way:

 

  1. A user grabs all of the code in the repository by “checking out” the repository.
  2. That user then modifies a local copy of the code on their local machine.
  3. When a user wants to save the changes they made, they “commit” their changes to the repository.

 

Odd conflicts can occur, though.  Think about the following case.  User A checks out the repository at 2:00pm and modifies the “nothing.txt” file but doesn’t commit.  User B checks out the repository at 3:00pm and modifies the “nothing.txt” file.  At 4:00pm, user B commits “nothing.txt” to the repository.  At 5:00pm, user A tries to commit “nothing.txt” to the repository.  User A would overwrite the changes that user B made, so SVN doesn’t allow this to happen.  The SVN Eclipse plug-in will require that user A “merge” their local copy of “nothing.txt” with the remote copy of “nothing.txt.”  The plug-in provides a slick synchronization window that makes this process easy.

 

Starting a repository with the SVN Eclipse Plug-in

First off, make sure that only one of your group members does this.  All of the other members should see the “Starting a project in Eclipse from an existing SVN project” section.

  1. Create a new, ordinary Java project just as you have done in the past.  Name it “Qubic”.
  2. Right click on the project once it’s created, and hover over the “Team” menu.  A new menu will show up with a “Share Project…” option.  Click on this option.
  3. Select “SVN” as the repository type
  4. Select the “Create a new repository option”
  5. In the “URL” field, supply the following URL where X is your assigned group number (note that there are no spaces, instead there are underscores (_)):

https://flatline.cs.washington.edu/cse190l_sp07_svn/cse190l_sp07_X

  1. You will be prompted with a username and password option.  Your username is cse190l_sp07_X where X is your group number, and your password is the password that was supplied to you.
  2. A dialogue box with a certificate might appear.  If this happens, just selected the “Accept temporarily” option.
  3. At this point, you should be logged in.  A menu with project information should appear.  Make sure the “Use project name as folder name” option is selected.  Click the “Next” button.
  4. You will now be prompted with a message to supply to SVN.  You can alter the default message, but this setup isn’t necessary.  Once a message is decided on, click the “Finish” button.
  5. To test that this works, refer to the “Interfacing with SVN” section.

 

Starting a project in Eclipse from an existing SVN project

The user who created the repository won’t have to do the below steps.

  1. Click the File -> New -> Project menu button.
  2. Select the “SVN” option in the wizards menu.
  3. Select the “Create a new repository” option.
  4. In the “URL” field, supply the following URL where X is your assigned group number (note that there are no spaces, but instead underscores (_)):

https://flatline.cs.washington.edu/cse190l_sp07_svn/ cse190l_sp07_X

  1. You will be prompted with a username and password option.  Your username is cse190l_sp07_X where X is your group number, and your password is the password that was supplied to you.
  2. A dialogue box with a certificate might appear.  If this happens, just selected the “Accept temporarily” option.  Click the “Next” button.
  3. In the file browser menu, select the “Qubic” folder right below the repository.  Click the “Next” button.
  4. Select the “check out as a project in the workspace” and name the project “Qubic”.  Make sure the “Head Revision” box is checked, and click the “Finish” button.

 

Interfacing with SVN

The SVN Eclipse plug-in makes interfacing with SVN very easy.  As mentioned before, the changes you make to files are done to a local copy, and the programmer must commit those changes to the foreign copy in the repository.  With that said, one can simply add, edit, and remove files in their local copy and commit their changes to the repository.  To commit, right click on the files or folders that you wish to commit and use the “Team -> Commit” menu to do so.  A prompt will show up requesting a message to be sent to the repository.  This message is useful so that one can later recollect the changes made to an earlier version.  The message can be left blank or filled in, but it’s recommend to be filled in.

 

**Important** - The “Team -> Update” menu will update the files and folders selected with the most recent copy.  Be sure to always do this before making changes to a local copy.  This ensures that the files you work on are fully up to date with everyone’s changes.

 

There are other capabilities that SVN offers such as version control and reverting to older versions, but these features won’t be described in this document.  Be sure to ask your TA any question you might have regarding SVN.  The TAs have slaved over SVN in the past and are totally capable of answering most questions.  If you’re not using Eclipse, then an application called Tortoise SVN will allow you to interface with the SVN repository.  Google should do an adequate job explaining how to download, install, and use Tortoise SVN.

 

 

SVN General Guidelines

  1. **Always use the Team -> Update method to ensure that your local copy is up to date before editing any files.
  2. If you plan to edit a file owned by someone else, then make sure to verify that that user has committed their changes to the repository.  This will avoid having to merge, which can be a pain sometimes.
  3. Never commit code that doesn’t compile.  If a commit has to be done, then comment out broken code and stub-ify methods that are incomplete.