Concurrent Versions System (CVS)

Eclipse comes with support for teams in the form of CVS, Concurrent Versions System. CVS is an open source tool to keep track of every version of a set of files. The versions and files are kept in a repository that is able to respond to requests like, “ give me version 1.9 of file Abc.java ”.

Let’s assume that you are working on a file “ TestClass.java ”. When the file is new, it is added to the repository, which basically means that file becomes known to the repository, and from that point onwards, the repository will keep record of the file and all its versions. After adding the file, some editing is made, and then those edits are “ checked in ” to the repository, which instructs the repository to watch the difference, store the difference, and then make the checked in file the current/latest copy of the file. After you have checked in your changes, the file version beomces 1.1, and any other user that has access to the repository can update their local copy with this version 1.1 from the repository. With the time, the file continues to be edited and newer and newer version are checked in, Since the repository has the file and all the old versions of that file, you are table to ask the repository for “ TestClass.java 1.2 “ ( 1.2 is the version no), even when the latest version is 1.56.

Along with single files versioned, everything in the repository can be marked as part of one version with a feature called “ Tag ” in CVS (“ Label ” in other versioning systems). A tag is basically a name for a single version of the project as a whole. For example,“ TestClass.java ” and “ Student.java “ could be two files in a project, but “ TestClass.java ” has latest verion as 2.6 and “ Student.java “ has latest version as 1.45. These two different versions will be tagged as part of “ Release_1 ”. Then at any point later in time, you could ask the repository for all the files tagged “ Release1 ”, and you would be back to “ TestClass.java 2.6 ” and ” Student.java 1.45 “.

Using CVS in eclipse is as simple as in these words. To get CVS set up on your computer, got to CVS’s home on net and download and install it. Eclipse ‘s latest versions include CVS with the default installations.

Here we will set up a simple project into a CVS repository from Eclipse. It is assumed that the user has permissions on CVS repository to add new projects in it.

  1. To start, “ right click ” the project and from menu select “ Team ” – > “ Share Project ”.
  2. On selecting “ Share Project ”, window will appear to ask things specific to CVS repository location.
  3. Since CVS server is on your machine host will be “ localhost ”. For location of repository consult file “ inetd.conf ”. For user name and password in CVS root search “ passwd ” file, set usernames and passwords in it and use one of them here. Module name can be any or use default.

On completing these steps, Eclipse has to send your project to CVS repository after verifying what is in project with add-in view called “ Synchronize ”. In synchronize perspective you can verify if all the files(being shown in Package Explorer) are the same, which you want to put in repository. If you want some file to get ignored from being put in repository, then right click on it and “ Add to .cvsignore ”.

After you are confident about the files you are putting in repository, from context menu of project selected, choose “ Commit ”. Now your project is updated to the repository at now, if you change any of these files, you will see change in annotations of that file. To get a new project from CVS, change the perspective. From CVS repository’s view choose “ New ” – > “ Repository Location ”, a familiar dialog box will connect you to CVS server and list down available projects on which you have access rights. From these projects select the project you want to work on set its working directory, get its latest version or check out (those files which you want to change and want to be locked during development). Similarly you can check in, after you have made changes in file, to the repository; compare the file with old file in repository; tag the file/files/project and can do all other things from eclipse which CVS allow to do with it.