CVS

-- EladLahav - 25 Nov 2005

Preemable

CVS is an easy to use, yet powerful and effective version control system. It is based on a client-server architecture that stores all files in a common place, thus allowing sevral people to collaborate on a project.

Terminology

Common terms used by CVS:

  • Repository: A collection of file and directory revisions managed by CVS. A repository is stored on the server-side.
  • Module: A project managed by CVS. A module is simply a directory in a CVS repository.
  • Tree: A snapshot of a module stored on the client-side.
  • Root: A string containing the access method, user name and path leading to a CVS repository.
  • Import: Populating a newly created module with files.
  • Checkout: The process of creating a tree in a work directory.
  • Update: Synchronising a tree so that it reflects the current state of the repository.
  • Commit: Synchronising a tree so that changes in the work directory are applied to the repository.

CVS Life Cycle

Working with CVS usually involves the following stages:

  1. Create a module in the repository and import files into it.
  2. Create (check-out) and maintain (update) a tree in a work directory.
  3. Work on your tree.
  4. Transfer (commit) your changes.

We shall assume that a repository was already created and that it is accessed only through rsh/ssh. The root will be

   :ext:elahav@hopper:/u3/elahav/cvsroot
   

where :ext: means that the repository can only be accessed using rsh, elahav is the user name, hopper is the server on which the repository resides and /u3/elahav/cvsroot is the path to the repository.

Note
To use ssh instead of rsh, set the environment variable CVS_RSH to ssh.

Every CVS command has the following form:

   cvs CVS_OPTIONS COMMAND COMMAND_OPTIONS
   

Most CVS commands work recursively, which means they are applied to all sub-directories.

Import

The import process creates a new module in the repository. The module is populated with all files in the current directory. The command has the following syntax:

   cvs -d ROOT import MODULE_NAME VENDOR_TAG START_TAG
   

where ROOT is the repository's root string, MODULE_NAME is simply the name of the module, and VENDOR_TAG and START_TAG are arbitrary symbols.

Note
You can get rid of the -d ROOT part by setting the CVSROOT environment variable to the root string.

Note
The vendor and start tags are just relics from old times. You can safely use the strings VENDOR and START for every module you create.

Assume ~/src/myproject is a directory containing the files to import. The following commands create the module myproject in the repository

   cd ~/src/myproject
   cvs -d :ext:elahav@hopper:/u3/elahav/cvsroot import myproject VENDOR START
   

Alternatively, we can use the CVSROOT environment variable:

   export CVSROOT=:ext:elahav@hopper:/u3/elahav/cvsroot
   cd ~/src/myproject
   cvs import myproject VENDOR START
   

Since CVS works recursively, all sub-directories and their files will also be imported.

Checkout

The checkout command creates a tree by copying the latest version of all files in a module into a the current directory. Its basic syntax is:

   cvs -d ROOT co MODULE_NAME
   

Checkout can also create the tree in a specified directory:

   cvs -d ROOT co -d DIR MODULE_NAME
   

For example, to check out the myproject module in the current directory

   cvs -d :ext:elahav@hopper:/u3/elahav/cvsroot co myproject
   

or, if CVSROOT has already been set correctly

   cvs co myproject
   

This command creates a directory called myproject under the current directory, populated with the module files (including all sub-directories). Each directory in the tree has a CVS sub-directory, which contains such information as the name of the module, its root and the files in this directory that are included in the module.

Edit | Attach | Watch | Print version | History: r6 | r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r2 - 2005-11-25 - EladLahav
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback