Book HomeLinux in a NutshellSearch this book

14.2. The CVS Utility

This section offers general background about CVS.

14.2.1. CVS Command Format

CVS commands are of the form:

cvs global_options command command_options

For example, here is a simple sequence of commands showing both kinds of options in the context of creating a repository, importing existing files, and performing a few common operations on them:

user@localhost$ cvs -d /usr/local/cvsrep init
user@localhost$ cd ~/work/hello
user@localhost$ cvs -d /usr/local/cvsrep import -m 'Import' hello vendor start
user@localhost$ cd ..
user@localhost$ mv hello hello.bak
user@localhost$ cvs -d /usr/local/cvsrep checkout hello
user@localhost$ cd hello
user@localhost$ vi hello
user@localhost$ cvs commit -m 'Fixed a typo'
user@localhost$ cvs tag hello-1_0
user@localhost$ cvs remove -f Makefile
user@localhost$ cvs commit -m 'Removed old Makefile'
user@localhost$ cvs upd -r hello-1_0
user@localhost$ cvs upd -A

Some global options are common to both user and administrator commands, and some are specific to each of these. The common global options are described in the next section, and the user and administrator options are described in the Section 14.4, "CVS User Reference" and Section 14.3, "CVS Administrator Reference" sections, respectively.

14.2.2. Common Global Options

Table 14-1 lists the global options that apply to both user and administrator commands.

Table 14-1. Common Global Options

Option Description
-b bindir

Location of external RCS programs. This option is obsolete, having been deprecated at CVS versions above 1.9.18.

-T tempdir

Absolute path for temporary files. Overrides the setting of $TMPDIR.

-v

--version

Display version and copyright information.

14.2.3. Gotchas

This section clarifies a few aspects of CVS that can sometimes cause confusion.

CVS's file orientation

While directories are supported, they are not versioned in the same way as traditional files. This is particularly important in the early evolutionary stages of a project, when the structure may be in flux. Also, if the project is undergoing major changes, the structure is likely to change. See later in Section 14.3.4, "Hacking the Repository".

CVS's text-orientation

There is no equivalent to diff for binary files, although CVS's support for binary files is usually sufficient. Use admin -kb to tell CVS a file is binary.

CVS's line-orientation

Moving a segment of code from one place in a file to another is seen as one delete (from the old location) and an unrelated add (to the new location).

CVS is not syntax-aware

As far as CVS is concerned, small formatting changes are equivalent to sweeping logic changes in the same line ranges.

RCS anachronisms

CVS was originally built on top of RCS, but now all the RCS-related functionality is internal to CVS itself. RCS still shows up in the name of the $RCSBIN environment variable and the description of the -b option, which are now obsolete.



Library Navigation Links

Copyright © 2001 O'Reilly & Associates. All rights reserved.