Introduction

We will be using the Concurrent Version System (CVS) in INFOSYS 255 as a mechanism for submitting electronic versions of your assignments (e.g. your Java programs). While this may seem like the process is more involved than it needs to be, it provides a good opportunity for you to learn one of the important software development tools. Furthermore, it is a tool that can be used for many types of other collaborative development, such as writing documentation.

There are a number of reasons to use a version control system:

Version Control with Eclipse and CVS

Version control is a process by which you can keep a recorded history of the changes to your files (e.g. software source/code). A version control system, such as the Concurrent Version System (CVS), is an system that helps you accomplish version control of your files.

A version control system is useful for a number of reasons, the most important is to keep a historical record of the various versions of files you are developing. Should you accidentally delete a file or a portion of a file that you are working on, you can recover the most recent version, or any version, of that file. Of course, you must periodically commit (a.k.a. "checked-in") your files to the version control system for this process work. A version control system is typically used by software development teams as a mechanism for sharing the development of the various files in a project.

Additional overviews of CVS can be found in the references section below.

Basic Version Control Concepts

A version control system typically has two parts. There is the versions control server and the clients. The version control server is accessed over a network – a local network or wide area network such as the Internet – by a version control client. The version control server manages access to the version control repository. Version control clients come in a variety of flavors: command line clients, window/gui clients, plug-in clients (for applications like Eclipse and file explorers).

Repository
This is where a copy of your files and directories are stored. Version control systems typically use some special file structure for tracking the differences between subsequent versions of a file.
Working Copy and Workspace
This is a copy of a file(s) (or project) in your local file system (not in the Repository). Workspaces map to Eclipe projects.
Project
Your files are grouped by project. Projects may have sub folders. A project is often a complete program; although, a project could be code for a software library or the XML/HTML files for documentation.
Commit
This is the process of saving files to the Repository. You may commit whole specific files or a whole project to the Repository.
Synchronize
This is the process of updating the local files on your computer with corresponding files in the repository.

CVS Clients

There are a variety of CVS clients: command line clients, windows clients (e.g. WinCVS), and plug-in clients like Tortise (plug-in for Windows Explorer) and the Eclipse CVS plug-in. This tutorial will address the Eclipse CVS plug-in. Note that the concepts carry over to other clients.

CVS and Eclipse

This tutorial assumes that you are familiar with Eclipse and have already created a project in Eclipse that you wish to version control.

Open CVS Perspective

There is an Eclipse perspective for CVS. You can enable this perspective from the Window menu:

Window → Perspective → CVS Repository Reporting

Figure: Open CVS Perspective

Open CVS Perspective menus

Figure: CVS Repository Exploring Perspective

CVS Repository Exploring Perspective

Connecting to a CVS Repository

It is necessary to establish a connection with a CVS repository (the version control server). To do this:

  1. Open the CVS perspective (see previous section).
  2. Right mouse click in the CVS Repositories window.
  3. From the right mouse click menu select New → Repository Location ...

    New Repository Location menu

  4. Complete the Add CVS Repository dialog as follows:
    • For Location Host, enter dream.sims.berkeley.edu
    • For Location Repository path, enter the path of the cvs repository. You will be using the repository located in your account's cvsroot directory/folder. The path will be of the the format: /home/ user-id /cvsroot
      For example: /home/oski/cvsroot
    • For Authentication User, put your SIMS user-id.
    • For Authentication Password, put your SIMS password.
    • For Connection Connection Type, select extssh from the drop-down list.
    • Check Validate Connection on Finish if it is not already selected.
    • Click the Finish button.

      Figure: Add CVS Repository Dialog

      Add CVS Repository Dialog

  5. After validation, CVS Repositories window in Eclipse will show the connected repository. Note that you can have multiple repositories.

    Figure: CVS Repositories

    CVS Repositories

Checking in (Committing) Your Project

To save (commit) your Eclipse project to the CVS Repository follow the instructions below.

Name your projects so that they include your first initial and last name and the assignment number. For example: oski.a3 or 255.oski.a3.

  1. Right mouse click on the project you wish to commit
  2. From the drop down menu select Team → Share Project ...

    Figure: Sharing a Project

    Sharing a Project

  3. From the Share Project dialog box, click on the Finish button.

    Figure: Sharing a Project

    Share Project Dialog

    Note that this step does not actually commit (save) the files to the repository.
  4. Check your files in the Synchronize window. To see the window, you may have to click on the Synchronize tab at the bottom of Eclipse (near the Tasks tab) or expand it from the bottom of Eclipse by dragging the upper boarder up.

    Figure: Synchronize Window

    Synchronize  Window

  5. Right mouse click on the project folder and then select Add to Version Control.

    Figure: Commit Project to Version Control

    Commit menu

  6. Right mouse click on the project folder and then select Commit (note: you can commit specific files if you wish to).
  7. Click Yes on the Add to Version Control Dialog

    Figure: Confirm Add to CVS Version Control

    Add to CVS Version Control dialog

  8. In the Commit dialog, optionally type in a brief reason why you are committing this project (or file) to CVS. Click OK.

    Figure: Commit Dialog

    Commit dialog

    Check that your files were committed by looking in the Synchronize window. It should be blank (or the specific files that you committed should not appear).

    Figure: Check Commit

    Synchronize Window

Updating/Committing Changes

The process of committing changes in your files that are also in CVS (your working copies), is similar to the process described in the previous section.

Synchronizing with a Project

TBD

Checking Out a Specific Version

TBD

Differencing

TBD

References

CVS--Concurrent Versions System
The official manual from http://www.cvshome.org
Open Source Development with CVS
by Karl Fogel and Moshe Bar
A free on-line book. Note that the commands are present in Unix/command-line terms and not from the point of view of Eclipse.
eclipse team cvs 2.1 faq
http://www.loria.fr/~molli/cvs/doc/cvs_1.html#SEC1
How to Synchronize With CVS from Eclipse
Introduction to CVS
Branching with Eclipse and CVS