Using CVS in Eclipse


CVS, or "Concurrent Versioning System" is a popular piece of version control software. Essentially, what this means is that it allows multiple programmers to work on the same project with a minimum of toe-stepping. This makes it useful for final projects in 335. Even better, Eclipse provides an easy interface to use with CVS.

 

This tutorial consists of 3 parts:

1)      How to obtain a Unix group and a CVS repository

2)      How to place a CVS repository into Eclipse

3)      How to interact with Eclipse's CVS interface

Step 1: How to get a Unix group and a CVS repository

In order to create a CVS repository, a unix group must first be designated that has access to that repository, and a location for your repository must actually be created on disk. All of this is taken care of by our lab staff, provided you go to

 

http://www.cs.arizona.edu/~apply/SECURE/GROUP.html

 

This will bring up the a webpage which is shown below. Please note that you will have to wait for quite some time (a few hours perhaps) before your repository is fully set up.

 

1)      Group name: Enter a name that begins with 3 and has part of your team name (8 characters max). You should enter a name here that you feel is original enough to avoid conflicts with other teams

 

2)      The login name of the team leader. If you do not know the last six digits of your CSID, go to http://www.cs.arizona.edu/~apply/SECURE/CSID.html to get your entire CSID, then use just the last 6 digits

 

3)      These are the CS login names of all your teammates. Note that this might not be the same as their email identities

 

4)      For duration of project, use the default. If you want to use this repository in the future, you can get it's life extended.

 

 

5)      Change CVS to "please create/retain …"

 

6)      You will not need a MySQL account for this class

 

7)      Press submit when all the above info is correct. If all is well, all group members will get an email alluding to their position with regards to the repository

 

Step 2: How to get a CVS repository in to Eclipse

Be sure that you have waited the proper length of time for the repository to be built before you attempt to get a project into the repository. 

 

Open Eclipse

Go to File > New > Other > CVS > Checkout Projects from CVS > Create new Repository location

 

When you click Next, the following window should appear.

 

 

 You now should be all set up with a repository. Note that this step must be done by all team members, not just the team leader, as above.

 

Your repository is now known in Eclipse, but it is void of content.

 

Step 3: How to interact with Eclipse's CVS interface

For the Team leader only

In Eclipse, create a new project named (or refactor if you already named the project)

 

Monopoly_1_TeamName   or     Risk_1_TeamName

 

Right click on the project folder and select Team > Share Project

 

 

A series of screens will pop up, but you should just use the default options provided. Use the existing repository you created in step 2, and use the module name as the project name.

 

Congratulations, you have just checked a project into the repository.


For all other members

 

In Eclipse, go to File > Import > Checkout project from CVS

 

Select "Use Existing repository location" and when the list of projects pop up, select the name of the project you will be working on (NOT CVSROOT).

 

Click the Finish Button

 

Congratulations, you have just checked a project out from the repository.

 

Step 4b: Working with CVS

 

There are 2 basic operations in CVS:

  1. Commit (replaces the repository copy with your local copy)

  2. Update (replace your local copy with the copy in the repository)

 

Whenever you want to interact with the repository, you should right click your project in the project explorer, and select Team > Synchronize with Repository. This will bring up the "Team Synchronizing perspective". To get back to the Java perspective, look near the upper right corner of the screen and change the option marked there to "Java:"

 

When the Team Synchronizing perspective is open, you will be presented with several different types of arrows:

 

A right facing gray arrow: You have code to be added to the repository. This code should be committed

 

A left facing gray arrow: Someone has deposited code in the repository that you have not yet seen. This code should be updated

 

A left facing blue arrow: Someone has modified code in the repository that you have not been working on. This code should be updated

 

A right facing blue arrow: You have modified code and nobody else has checked in a version of that code. This code should be committed.

A double headed red arrow: You have modified a local version of a piece of code, but a different version exists in the repository. Perhaps two people were working on it. There is really no "right way" to resolve these conflicts, so you should discuss it with your team. Though complex resolution tools are available, my advice is to pick the "better" version. If that is the local copy, do an override and commit. If the "better" copy is the repository copy, do an override and update.