Previous section   Next section

10.2 CVS Commands

Most of your interaction with CVS is through the various CVS commands. Even if you use a graphical client, most of the functions the client uses call the CVS commands.

Most commands have a shortened nickname that you can type instead of the longer command name. These are called command synonyms in CVS jargon.

add Synonyms: ad, new

cvs [cvs-options] add [-k mode] [-m message] files

Adds a file or directory to the repository. This command can also be used to undo an uncommitted file deletion or to restore a deleted file. Remember, you must commit any added files in order for the addition to fully take effect.

Command options

-k mode

Add a file or files with the designated keyword-expansion mode. This option also sets the default keyword mode for the file. If you forget to set the default keyword mode with cvs add, you can do so later with cvs admin.

The keyword-expansion modes are listed in Section 11.6 of Chapter 11.

-m message

Use the specified message as the description of the newly added file. The description is shown in cvs log output.

Example

bash-2.05a$ cvs add Design.rtf 
cvs server: scheduling file `Design.rtf' for addition
cvs server: use 'cvs commit' to add this file permanently
admin Synonyms: adm, rcs

cvs [cvs-options] admin [-iILqU] [-ausernames] [-Afilename] [-b[revision]] 
[-cstring] [-e[usernames]] [-kmode] [-l[revision]] [-mrevision:message] 
[-ntagname[:[revision]]] [-Ntagname[:[revision]]] [-orange] [-sstate[:revision]] 
[-t[filename]] [-t-string] [-u[revision]] [-VN] [-xsuffix] [files...]

Use RCS commands on the repository copy of project files.

Command options

-ausernames

Append the comma-separated list of usernames to the RCS access list in the repository (RCS-format) copy of a file. This change to an RCS file has no effect on CVS.

See also -A and -e.

-Afilename

Append the RCS access list in filename to the access list of the files being operated on.This change to an RCS file has no effect on CVS.

See also -a and -e.

-b[revision]

Set the default branch of a file to the named branch revision; or, if no revision is named, set the default branch to the highest branch revision on the trunk. This option should be used very rarely in CVS; it is better to check out a sandbox as a branch sandbox with the -r option to checkout or update.

-cstring

Set the RCS comment leader of a file to the specified string. This option is not used in CVS.

-e[usernames]

Remove the comma-separated list of usernames from the RCS access list in the repository (RCS-format) copy of a file. If no list of usernames is provided, remove all names.This change to an RCS file has no effect on CVS.

See also -a and -A.

-i

Create and initialize an RCS file. This option is not used in CVS (use cvs add instead), and it is not available in CVS 1.9.14 and later.

-I

Run interactively. This option does not work in client/server-mode CVS and may be removed from later versions of CVS.

-kmode

Set the default keyword-expansion mode for a file.

The keyword-expansion modes are listed in Section 11.6 of Chapter 11.

-l[revision]

Lock the specified revision of a file so that another user cannot commit to it. If revision is omitted, CVS locks the latest revision on the current sandbox's branch or the trunk. To work with CVS, the lock requires a script such as the rcslock script in the contrib directory of the source. Chapter 5 explains how to use this option.

See also -u.

-L

Set RCS locking for a file to strict, which means that the owner of the file must lock the file before committing. (This locking is done by the CVS code, and need not be done manually.)

File locking must be set to strict for CVS to work properly.

See also -U.

-mrevision:message

Replace the log message of the designated revision of a file with the specified message.

-ntagname[:[revision]]

Tag the designated revision or branch of a file with the tagname. If there is no revision and no colon, delete the tag; if there is a colon but no revision, tag the latest revision on the default branch, usually the trunk. If the tagname is already present in the file (and the operation isn't delete), this option prints an error and exits.

Generally, it is better to use cvs tag and cvs rtag to manipulate tags.

See also -N.

-Ntagname[:[revision]]

Tag the designated revision or branch of a file with the tagname. If there is no revision and no colon, delete the tag; if there is a colon but no revision, tag the latest revision on the default branch, usually the trunk. If the tagname is already present in the file (and the operation isn't delete), this option moves the tag to the new revision.

Generally, it is better to use cvs tag and cvs rtag to manipulate tags.

See also -n.

-orange

Delete the revisions specified in the range. The revisions given in the range can be revision numbers or tags, but be wary of using tags if multiple tags in a file denote the same revision.

There is no way to undo a cvs admin -orange command.

The range can be any of the following:

revision1:revision2

Delete revisions between revision1 and revision2, including revision1 and revision2.

revision1::revision2

Delete revisions between revision1 and revision2, excluding revision1 and revision2.

revision:

Delete revision and all newer revisions on the same branch (or the trunk).

revision::

Delete all revisions newer than revision on the same branch (or the trunk).

:revision

Delete revision and all older revisions on the same branch (or the trunk). This range does not delete the base revision of the branch or revision 1.1.

::revision

Delete all revisions older then revision on the same branch (or the trunk). This range does not delete the base revision of the branch or revision 1.1.

revision

Delete revision.

-q

Run quietly, without printing diagnostics (redundant with cvs -q admin).

-sstate[:revision]

Set the state of the designated revision of a file, or set the last revision on the trunk or the current branch if no revision is listed. The state should be a string and is shown in the output of cvs log and by the Log and State keywords. The dead state is reserved for CVS internal use.

-t[filename]

Write the contents of the file specified by filename to the description of each file listed in the command. The description is an RCS field, shown in cvs log output. This option deletes any existing description. If the filename is omitted, CVS seeks input from standard input (stdin), ending with a period (.) on a line by itself.

See also -t-string.

-t-string

Write the contents of the string to the description of each file listed in the command. The description is an RCS field, shown in cvs log output. This option deletes any existing description.

See also -t[filename].

-u[revision]

Unlock the specified revision of a file so that another user can commit from that revision. If the revision is omitted, this option unlocks the latest revision on the current sandbox's branch or the trunk. This option requires a script such as the rcslock script in the contrib directory of the source. Chapter 5 explains how to use this option.

See also -l.

-U

Set RCS locking for a file to nonstrict, which means that the owner of the file does not need to lock the file before committing. (This locking is done by the CVS code and need not be done manually.)

File locking must be set to strict for CVS to work properly. This option should never be used on CVS-stored files.

See also -L.

-VN

Write an RCS file compatible with RCS version N. This option is not used in CVS anymore, and it is not available in CVS 1.9.20 and later.

-xsuffix

Specify the suffix for the RCS file. This option is not used or available in CVS (all CVS files use ,v as the suffix).

Description

The cvs admin command is a frontend for a range of useful (though sometimes useless to CVS) RCS-based commands. Project files are stored in the repository in RCS format, so it is useful to have a way to use some of the RCS commands on the files directly. This command and the useful options are explained in Chapter 8.

Example

bash-2.05a$ cvs admin -kb AcceptanceTest.doc 
RCS file: /var/lib/cvs/wizzard/doc/design/AcceptanceTest.doc,v
done
annotate Synonym: ann

cvs [cvs-options] annotate [-fFlR] [-D date] [-r revision] [files...]

Displays a file or files with annotations showing the last editor and revision that changed each line of the file. If no files are used in the argument, the files in the current sandbox are shown.

See also rannotate.

Command options

-D date

Run annotate on the latest revision of a file that is as old as or older than the date or time specified by date.

-f

Use the latest (HEAD) revision of a file that is on the current branch or trunk if no revision matches a specified date or revision number. This option applies only if -r or -D is used.

-F

Show annotations for binary files.

-l

Run annotate on the files in the local directory only. (Do not recurse into subdirectories.)

-r revision

Run annotate on the specified revision or tag of a file. If this option refers to a branch, run the command on the latest (HEAD) revision of the branch.

-R

Run annotate on the files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

Example

bash-2.05a$ cvs annotate Makefile
   
Annotations for Makefile
***************
1.2  (jenn     01-Sep-02): #
1.2  (jenn     01-Sep-02): # Makefile for the Wizzard project
1.2  (jenn     01-Sep-02): # Created by J Vesperman, 1 September 2002
checkout Synonyms: co, get

cvs [cvs-options] checkout [-AcflnNpPrs] [-d directory-name] [-D date]
[-j revision[:date]] [-j revision2[:date2]] [-k mode] [-r revision] projects...

Creates a new sandbox in the current working directory. This command can also be used to update an existing sandbox.

See also export and update.

Command options

-A

Clear sticky tags, dates, and keyword-expansion modes from a project and replace the current files with the head of the trunk.

-c

Display the contents of the modules file in the repository's CVSROOT directory. This option lists the modules in the current repository and the options applicable to those modules.

See also -s.

checkout -c lists only those projects that have entries in the modules file.

-d directory-name

Check a sandbox out into a directory called directory-name instead of using the repository directory name or the name designated in the modules file in the repository's CVSROOT directory. This is particularly useful when creating a second sandbox for a project.

CVS usually creates the same directory structure that the repository uses. However, if the checkout parameter contains only one file or directory and the -d option is used, CVS does not create any intervening directories. Use -N to prevent CVS from shortening the path.

-D date

Check out the latest revision of each file in a project that is as old as or older than the date or time specified by date. This option implies the -P option and produces a sticky date on the new sandbox.

-f

Use the latest (HEAD) revision on the current branch or trunk if no revision matches the date or revision number. This applies only if -r or -D is used.

-j revision[:date]

Determine the changes between the revision the files in the sandbox are based on and the specified revision and merge those changes to the sandbox.

If two -j options are used, determine the changes between the first -j revision and the second -j revision and merge those changes to the sandbox.

The date can be used only if the revision designates a branch. date specifies the latest revision on that date.

-k mode

Check out a sandbox with the designated keyword-expansion mode. This option also sets a sticky keyword mode for the sandbox, so that later commands operate with the same keyword-expansion mode unless a -k option overrides that mode. The -k option overrides the default mode for each file.

The keyword-expansion modes are listed in Section 11.6 of Chapter 11.

-l

Run checkout on the local directory only. (Do not check out subdirectories.)

See also -R.

-n

Do not run any program listed in the modules file for this directory.

-N

Do not shorten the path. CVS usually creates the same directory structure that the repository uses. However, if the checkout contains only one file and the -d option is used, CVS does not create any intervening directories unless -N is also specified.

-p

Check out the listed files to the standard output, rather than to the filesystem.

-P

Do not include empty directories in the sandbox.

-r revision

Run checkout on the specified revision or tag. If this option refers to a branch, run the command on the latest (HEAD) revision of the branch. This option implies the -P option and produces a sticky tag on the new sandbox.

-R

Run checkout on the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

-s

Display the contents of the modules file in the repository's CVSROOT directory. This option lists the modules in the current repository and their status.

See also -c.

Description

The projects argument to checkout may be one or more paths to directories within the repository, paths to files within the repository, or module names as specified in the modules file in the repository's CVSROOT directory. These paths must be separated by spaces.

When creating a new sandbox, the repository path must be specified by using the -d repository_path CVS option or the CVSROOT environment variable.

If you are creating a new sandbox inside an existing sandbox, the CVS/Root file of the current directory in the existing sandbox can provide a repository path. In most cases, having a sandbox inside a sandbox is needlessly confusing.

Example

bash-2.05a$ cvs -d cvs:/var/lib/cvs checkout wizzard
cvs server: Updating wizzard
U wizzard/Changelog
U wizzard/INSTALL
U wizzard/Makefile
commit Synonyms: ci, com

cvs [cvs-options] commit [-flnR] [-m message | -F logfile] [-r revision] [files...]

Commits changes in a sandbox to the repository.

Command options

-f

Force CVS to commit a file even if there have been no changes to the file. This option implies the -l option.

-F logfile

Read a log message from the specified logfile rather than calling an editor.

-l

Run commit on the files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-m message

Use the message when committing a file. CVS does not call the editor.

-n

Do not run any program listed in the modules file (in the repository's CVSROOT directory) for this directory.

-r revision

Commit any changes to the specified revision number. The revision number must be higher than any current revision number for the file or files.

If revision is a branch tag or a revision number on a branch, commit to the head of the branch.

-R

Run commit on the files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Description

The cvs commit command uploads changes in a sandbox to the repository. Until a commit is run, changes such as modified, new, or removed files are not reflected in the repository. If no files are listed as arguments, CVS uploads all changes in the current sandbox.

Unless you use either the -m or -F options, commit calls an editor to request a log message.

If there have been changes in the repository version of a file since it was last synchronized with the repository and the local version has also changed, you have a conflict and the file cannot be committed. You can try to commit the file again once you have updated it using cvs update or cvs checkout. The update will include an attempt to merge the file. See Chapter 3 for an explanation of file conflicts.

Example

/home/jenn/cvs/wizzard$ cvs commit
cvs commit: Examining .
cvs commit: Examining doc
cvs commit: Examining lib
.
.
.
RCS file: /var/lib/cvs/wizzard/doc/design/Design.rtf,v
done
Checking in doc/design/Design.rtf;
/var/lib/cvs/wizzard/doc/design/Design.rtf,v  <--  Design.rtf
initial revision: 1.1
done
diff Synonyms: di, dif

cvs [cvs-options] diff [format-options] [-lR] [-D date] [-D date2] [-f file] 
[-k mode] [-r revision] [-r revision2] [files...]

Displays the differences between two revisions of a file or files. By default, diff checks the sandbox copy against the revision in the repository that the sandbox copy was last synchronized with. If the files argument is a directory, all files under that directory are compared and files in subdirectories are also compared recursively.

See also rdiff.

Standard options

Options described in this section determine which files and revisions are compared by cvs diff. These options are the same as the standard options for most CVS commands. The -k option may be used to slightly modify the data sent to diff.

-D date

Display the differences between the current sandbox copy of a file and the latest revision on or before the date or time specified by date.

If two -D options are used, display the differences between the latest revision before the first date and the latest revision before the second date.

-k mode

Run diff with the designated keyword-expansion mode. This option overrides the default mode and any sticky modes for each file.

The keyword-expansion modes are listed in Section 11.6 of Chapter 11.

-l

Run diff on the files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-r revision

Display the differences between the current sandbox copy and the specified revision.

If two -r options are used, display the differences between the first and second specified revisions.

-R

Run diff on the files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Format options

These options determine how cvs diff displays any differences it finds. They represent the format-options portion of the syntax and operate in the same way as the options to the GNU diff program.

-number

Show number lines of context. This option is obsolete and should be replaced with either -C number or -U number. (This option must be used with -c or -u.)

-a or --text

Compare files line-by-line, treating the files as text files.

-b or --ignore-space-change

Ignore trailing whitespace and consider all sequences of whitespace characters to be equivalent.

-B or --ignore-blank-lines

Ignore changes to blank lines, such as addition or deletion.

--binary

Read and write data in binary mode.

--brief

Report only whether the files are different, not how they are different.

-c or -C number or --context[=number]

Use context-output format, displaying number lines of context around each change. The default is two lines.

-d or --minimal

Use an algorithm that is slower but tries to express the differences between the files in the fewest possible steps, sometimes creating a smaller list of changes to be made than the standard algorithm does.

-e or --ed

Produce the output in the form of a script that you can run with the ed text editor to convert the first revision to the second.

-f or --forward-ed

Produce output that is similar to an ed script, but with the changes in the order in which they occur in the file. The resulting output is not a script; it is simply in a format similar to an ed script.

-F re or --show-function-line=re

For each set of differences, show the most recent line that matches the regular expression re.

-H or --speed-large-files

Use heuristics that help make diff faster if it is reading large files with many scattered small changes.

--horizon-lines=number

If the files have a common header and footer, display the last number lines of the header and the first number lines of the footer.

-i or --ignore-case

Do not report on changes of letter case. Consider upper- and lowercase letters as identical.

-I re or --ignore-matching-lines=re

Do not report on changes that insert or delete lines that match the regular expression re.

--ifdef=NAME

Produce a merged file as output, with C preprocessor #ifdef=NAME structures around the differences.

-L label or --label label

Use label instead of the filename in the diff output headers.

--left-column

Where the lines are the same, display only the line in the left column.

-n or --rcs

Produce a diff in RCS format rather than GNU format.

-N or --new-file

If directories are being compared and a file is not found in one directory, treat the file as if it were there but empty.

-p or --show-c-function

In the output, display the name of the C function each change is in.

-s or --report-identical-files

Report files that are identical.

--suppress-common-lines

In side-by-side format, do not display lines that are the same.

-t or --expand-tabs

Display the output with spaces instead of tabs.

-T or --initial-tab

Prepend a tab to the output to ensure that all subsequent tabs line up properly.

-u or -U number --unified[=number]

Use unified-output format, displaying number lines of context around each change. The default is two lines.

-w or --ignore-all-space

Ignore all differences in whitespace.

-W number or --width=number

Produce side-by-side output that is no more than number columns wide.

-y or --side-by-side

Use side-by-side output format.

Line and group format options

Line and group formats allow you to modify the way diff displays line changes. The group format options control the markers that surround the change, and the line format options control the marks on the changed lines themselves. Group format options are often used to create if-then-else structures for automated parsers to use.

The format options have a format string as a parameter and display the lines they affect according to the rule provided in the format string. The format string usually contains characters that are interpreted by your operating systems shell, so the string usually needs to be surrounded by your shell's quote character.

Following are the group format options, which affect the markers surrounding changed lines:

--old-group-format=format-string

Display the text defined by the format string for each group of lines from the first file that are different or missing in the second file.

--new-group-format=format-string

Display the text defined by the format string for each group of lines from the second file that are different or missing in the first file.

--changed-group-format=format-string

Display the text defined by the format string for each group of lines that are different between files, usually a concatenation of the old and new group format strings.

--unchanged-group-format=format-string

Display the text defined by the format string for each group of lines that are the same in both files.

Following are the line format options, which affect the lines themselves:

--old-line-format=format-string

Display the text defined by the format string for each line from the first file that is different or missing in the second file.

--new-line-format=format-string

Display the text defined by the format string for each line from the second file that is different or missing in the first file.

--unchanged-line-format=format-string

Display the text defined by the format string for each line that is the same in both files.

--line-format=format-string

Display the text defined by the format string for all lines.

The format-string for both group and line formats uses the percent (%) character as a special token, denoting a string to be evaluated by cvs diff. The string %% represents a single percent character. You also need to know your shell's quoting rules if you wish to include your shell's quote marks in the format string.

These are the special characters for a line format-string:

%l

The contents of the line to be formatted, not including the newline character.

%L

The contents of the line to be formatted, including the newline character. If a line does not contain a newline character, this character does not add it.

%[-][width][.[digits]][doxX]n

A printf-style format-string that displays the line number of the current line. The hyphen (-) signals that the number should be left-justified. The width specifies the minimum field width, and the digits specifies the minimum number of digits. The other options are d (for decimal), o (for octal), and x or X (for lower- or uppercase hexadecimal).

%%

The percent character.

%c'C'

The character C, which cannot be a quote or a backslash.

%c'\O'

The character represented by the octal string O.

These are the special characters for a group format-string:

%<

The lines from the first file.

%>

The lines from the second file.

%=

Lines common to both files.

%[-][width][.[digits]][doxX]symbol

A printf-style format-string that displays the number denoted by the symbol. The hyphen (-) signals that the number should be left-justified. The width specifies the minimum field width, and the digits specifies the minimum number of digits. The other options are d (for decimal) o (for octal), and x or X (for lower- or uppercase hexadecimal).

Lowercase symbols denote the first file. Uppercase symbols denote the second file. The symbols are:

E or e

The line number of the line just before the group.

F or f

The line number of the first line in the group.

L or l

The line number of the last line in the group.

M or m

The line number of the line just after the group.

N or n

The number of lines in the group.

%(A=B?C:D)

If A is equal to B, display C; otherwise, display D. A and B must be decimal constants or a single letter that is one of the symbols provided.

%%

The percent character.

%c'C'

The character C, which cannot be a quote or a backslash.

%c'\O'

The character represented by the octal string O.

Example 1

This is a simple example to show how CVS displays the difference between the current and repository revisions of the Makefile.

bash-2.05a$ cvs diff Makefile
Index: Makefile
=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
RCS file: /var/lib/cvs/wizzard/Makefile,v
retrieving revision 1.6
diff -r1.6 Makefile
25a26
> rm -f lib/*.o

Example 2

This example is more complicated. It shows how to use cvs diff with group format strings. No revisions are specified, so CVS compares the repository and current sandbox revisions of the cvs_admin.html file. The --old-group-format option and the format string specified with it cause sets of lines from the older revision that are changed in the new revision to be surrounded by #ifdef OLD and #else. The --new-group-format option and its format string put #endif after sets of lines from the new revision. The quotes around the format strings prevent my shell from interpreting the strings.

bash-2.05a$ cvs diff \
--old-group-format="#ifdef%c'\040'OLD%c'\012'%<%c'\012'#else%c'\012'" \
--new-group-format="%>%c'\012'#endif%c'\012'" cvs_admin.html
Index: cvs_admin.html
=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
RCS file: /var/lib/cvs/oreilly/articles/cvs/cvs_admin.html,v
retrieving revision 1.16
diff --old-group-format=#ifdef%c'\040'OLD%c'\012'%<%c'\012'#else%c'\012' --new-group-
format=%>%c'\012'#endif%c'\012' -r1.16 cvs_admin.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>CVS Administration</title>
</head>
<body>
   
    <h1>CVS Administration</h1>
   
   
<p>
#ifdef OLD
CVS - or Concurrent Versioning System -  is a tool for saving the user's butt by 
maintaining a history of changes. It allows the retrieval of older versions of files, 
records who makes each change, and prevents simultaneous changes from overwriting 
each other.
#else
CVS - or Concurrent Versioning System - is a tool for protecting the user from their 
own mistakes, by maintaining a history of changes. It allows you to fetch older 
versions of files, records which person makes each change, and prevents simultaneous 
changes from overwriting each other.
   
#endif
</p>
<p>
#ifdef OLD
CVS expects the files it maintains to be stored in modules - directories of related 
files and subdirectories. A module can be as small as a single directory containing a 
single file, or as large as you have disk space for.
   
#else
CVS expects the files it maintains to be stored in projects - directories of related 
files and subdirectories. A project can be as small as a single directory containing 
a single file, or as large as you have disk space for.
   
#endif
</p>
.
.
.
edit Synonyms: none

cvs [cvs-options] edit [-lR] [-a action...] [files...]

Marks a file as being edited by the current user.

See also editors, unedit, watch, and watchers.

Command options

-a action

Notify the user when the specified action occurs to the file. This setting acts as a temporary watch (see watch) on the file and is removed when the file is no longer being edited. Each -a designates one of the possible actions. The -a option can be repeated to designate multiple actions.

The action may be any of the following:

edit

Notify the user if someone else has run cvs edit on the file.

unedit

Notify the user when the file is no longer being edited by someone else. This notification is triggered by the user running cvs unedit or cvs release or by the file being deleted and recreated with cvs update or cvs checkout.

commit

Notify the user when someone else commits changes to the file.

all

Notify the user of all of the previous actions.

none

Notify the user of none of the previous actions.

-l

Run edit on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-R

Run edit on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Description

The cvs edit command is used as part of the cvs watch family of commands. If a file is being watched, it is checked out to the sandbox with read permissions but not write permissions. The edit command sets the sandbox file as writable, notifies any watchers that the file is being edited, and sets the user as a temporary watcher to be notified if certain actions are performed on the file by other users.

CVS does not notify you of your own changes.

You can unedit (set read-only and clear the temporary watch) a file with cvs unedit or cvs release, or by removing the file and recreating it with cvs update or cvs checkout.

CVS uses any script in the notify file in the repository's CVSROOT directory to notify the user of changes.

Example

bash-2.05a$ cvs edit Makefile
bash-2.05a$
editors Synonyms: none

cvs [cvs-options] editors [-lR] [files...]

Displays the list of people who have a current edit command for the file or files listed as parameters. If no files are listed, this command lists the editors for the files in the current directory and subdirectories.

See also edit, unedit, watch, and watchers.

Command options

-l

Run editors on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-R

Run editors on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Example

bash-2.05a$ cvs editors Makefile
Makefile jenn Sat Oct 26 01:51:02 2002 GMT helit /home/jenn/cvs/wizzard
export Synonyms: exp, ex

cvs [cvs-options] export [-flnNR] [-r revision] [-d directory-name] [-D date] 
[-k mode] [-r revision] project

Create a directory containing all directories and files belonging to a specified release of a project, with no CVS administrative files.

See also checkout and update.

Command options

-d directory-name

Export the project into a directory called directory-name instead of using the repository directory name or the name designated in the modules file in the repository's CVSROOT directory.

CVS usually creates the same directory structure that the repository uses. However, if the export contains only one file and -d is used, CVS does not create any intervening directories. Use -N to prevent CVS from shortening the path.

-D date

Export the latest revision of each file in a project that is older than the date or time specified by date. This option implies the -P option.

-f

Use the latest (HEAD) revision on the current branch or trunk of a project if no revision matches the date or revision number. This applies only if -r or -D is used.

-k mode

Export a release with the designated keyword-expansion mode. This option overrides the default mode for each file.

The keyword-expansion modes are listed in Section 11.6 of Chapter 11.

-l

Run export on the files in the local directory only. (Do not recurse into subdirectories.)

See also -R.

-n

Do not run any program listed in the relevant line of the modules file in the repository's CVSROOT directory.

-N

Do not shorten the path. CVS usually creates the same directory structure that the repository uses. However, if the export contains only one file and -d is used, CVS does not create any intervening directories unless -N is also specified.

-r revision

Run export on the specified revision or tag of each file in a project. If this revision or tag refers to a branch, run the command on the latest (HEAD) revision of the branch. This option implies the -P option.

-R

Run export on the directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Description

The cvs export command creates the directories and files that belong to a project as of a specific tagged release, revision number, or date. It acts like a checkout or update for that specific point, but it does not produce the CVS administrative files. export requires the -r or -D command options.

When exporting, the repository path must be specified by using the -d repository_path CVS option or the CVSROOT environment variable.

You can imply the repository path by being in a sandbox, but exporting into a sandbox is not recommended.

The argument to export can be a directory name or path within the repository, a filename or path within the repository, or a module name as specified in the modules file in the repository's CVSROOT directory.

Example

bash-2.05a$ cvs -d cvs:/var/lib/cvs export -D now wizzard
cvs server: Updating wizzard
U wizzard/Changelog
U wizzard/INSTALL
U wizzard/Makefile
history Synonyms: hi, his

cvs [cvs-options] history [-aceloTw] [-b string] [-D date] [-f file] [-m module] 
[-n module] [-p directory] [-r revision] [-t tag] [-u username] [-x flag...] 
[-z timezone] [files...]

Displays the information stored in the history file in the repository's CVSROOT directory. If that file does not exist or is not writable, the history command fails with an error. CVS writes to the history file during checkout, export, commit, rtag, update, and release operations.

The -f, -l, -n, and -p options for cvs history act differently than their normal uses in CVS.

Command options

-a

Show history data for all users. By default, CVS shows only the data for the calling user.

-b string

Show data that is more recent than the newest record that contains the given string in the module name, filename, or repository path.

-c

Report only commits�times when the repository was modified (equivalent to -xAMR).

-D date

Report data that is more recent than the given date or time. (See Section 11.4 in Chapter 11 for legal dates.)

-e

Report on every record type. This option is equivalent to -x with every type specified.

-f file

Show data for the specified file. This option can be repeated to show data for multiple files.

-l

Show only the most recent commit to the repository.

-m module or -n module

Show data for a particular module. Using -m, CVS checks the modules file in the repository's CVSROOT directory and then searches the history file for files and directories that belong to the module. Using -n, CVS searches only the history file for the specified module name.

-o

Report on records of checkouts (equivalent to -xO).

-p directory

Show records for a particular project directory. This option can be repeated to show records for several projects.

-r revision

Show data as of, or more recent than, the revision or tag. CVS searches the repository's project files to determine the timestamp of the revision.

-t tagname

Show data as of, or more recent than, the latest time a tag record with this tagname was stored in the history file by any user.

-T

Report on records of tags (equivalent to -xT).

-u username

Report on records for the specified username. This option can be repeated to search for multiple users.

-w

Report on records of actions that match the current working directory.

-x [ACEFGMORTUW]

Extract records that match the given flag or flags. Any number of flags can be used with the -x option. cvs history extracts all records in the history file that match this option and all other options. The flags may be any of the following:

A

Report on records of files added to the repository.

C

Report on records of files that would have been updated in a sandbox, but where the files needed to be merged and there were conflicts in the merge.

E

Report on records of files exported from the repository.

F

Report on records of files that were released.

G

Report on records of files updated in a sandbox with a successful merge.

M

Report on records of files that were modified (a sandbox revision added to the repository).

O

Report on records of files that were checked out.

R

Report on records of files that were removed from the repository.

T

Report on records of files that were rtagged.

U

Report on records of files updated in a sandbox file with no merge required.

W

Report on records of files deleted from a sandbox during an update because they were no longer active in the repository.

-z timezone

Produce output and convert times to the specified timezone. The time zone can be a recognized abbreviation such as EST, or it can be given as an offset of UTC. Time zones are listed in Chapter 11.

Example

bash-2.05a$ cvs history
O 2002-10-03 08:33 +0000 jenn wizzard/src =wizmain=     <remote>/*
O 2002-10-03 09:12 +0000 jenn wizzard     =wizmake=     <remote>/*
O 2002-10-03 09:12 +0000 jenn wizzard/src =wiztest=     <remote>/*
O 2002-10-25 08:58 +0000 jenn wizzard     =wizzard=     <remote>/*
import Synonyms: im, imp

cvs [cvs-options] import [-b branch] [-d] [-I ignore] [-k mode] [-m message]
[-W wrapper] project-name vendor-tag release-tag

Creates a new project in the repository or manages vendor branches.

Command options

-b branch

Import to the specified vendor branch. If you have more than one external supplier for a project, you may need to use two or more distinct vendor branches to manage the project. If you are using multiple vendor branches, use the -b option to specify which branch you are importing to. branch must be the branch number, not a tag, and CVS does not check that the branch number given with the option and the symbolic tag provided as the vendor-tag argument to the command correspond to the same branch.

I strongly recommend that you read Section 7.1.3 in Chapter 7 before using this option.

-d

When setting the timestamp on each imported file, use each file's last modification time rather than the current time.

-I ignore

Ignore the named file when updating. -I can be used more than once. Use -I ! to clear the list of ignored files. See Section 6.5.3.2 in Chapter 6.

-k mode

Import the file or files with the designated keyword-expansion mode. This option also sets the default keyword mode for the file. If you forget to set the default keyword mode with cvs import, you can do it later with cvs admin.

The keyword-expansion modes are listed in Section 11.6 of Chapter 11.

-m message

Use the message when committing a file. CVS does not call the editor the next time cvs commit runs.

-W wrapper

Modify the import based on elements of each filename. Wrappers are explained in Chapter 3.

Description

To create a new project, lay out the project structure and any initial files. You can do this in a temporary directory, as CVS does not need the initial structure or files once the project has been imported. Change directories into the root directory of the new project, then run cvs import. You need to specify the repository path and provide a project name and two tags: a vendor tag and a release tag.

Test that you can cvs checkout the new project before removing the original files.

The project name will become the project's root directory name. The tags are less critical; if you do not intend to use a vendor branch, a meaningless pair of tags such as a1 b2 is sufficient. The tag names must conform to all the normal requirements for tags: they must start with a letter and can contain only alphanumeric characters, underscores (_), and hyphens (-). The HEAD and BASE tag names are reserved.

A vendor branch is a special branch that CVS provides to track third-party code that contributes to a project. If you use vendor branches, CVS uses the vendor tag as a branch tag for the vendor branch, and it uses the release tag to mark the current revisions of the vendor branch files.

Create a vendor branch by using cvs import to create the project. When you want to update to a new release from the vendor, use cvs import on the same project with the same vendor tag and a new release tag. See Chapter 7 for a full explanation of vendor branches.

Example

bash-2.05a$ cvs -d cvs:/var/lib/cvs import wizzard wizproject ver_0-1
.
.
.
"/tmp/cvsfaQoRz" 5L, 287C written
No conflicts created by this import
init Synonyms: none

cvs [cvs-options] init

Converts an existing directory into a CVS repository and creates and populates the CVSROOT directory that contains the administrative files for a CVS repository.

CVS creates the final directory in the path if it does not already exist. Previous directories in the path must exist.

Example

$ cvs -d /var/lib/cvsroot init
kserver Synonyms: none

cvs [cvs-options] kserver

Runs the repository-server end of a Kerberos 4 connection. The cvs kserver command must be called from inetd or an equivalent server daemon. See Chapter 8.

See also pserver.

Example

#inetd.conf
#:OTHER: Other services
1999 stream tcp nowait root /usr/bin/cvs cvs -f --allow-root=/var/lib/cvsroot kserver
log Synonym: lo

cvs [cvs-options] log [-bhlNRSt] [-d dates] [-r[revisions]] [-s states]
 [-w[usernames]] [files...]

Displays information about the files in the current sandbox or the files specified as parameters. The information this command provides is part of the header section of the files in the repository. This command also provides information from the log messages created when files are imported or changes are committed.

With no options, cvs log displays all the information it has available. See also rlog.

Command options

-b

Display information only about the revisions on the default branch, normally the trunk.

-d dates

Display information only on revisions checked in on or between the dates or times provided. Date and time formats are listed in Chapter 11. More than one date range can be given; ranges must be separated by semicolons. Date ranges can be specified according to the following list:

date1>date2 or date2<date1

Select all revisions between the two dates.

date1>=date2 or date2<=date1

Select all revisions on or between the two dates.

date> or <date

Select all revisions earlier than date.

date>= or <=date

Select all revisions on or earlier than date.

date< or >date

Select all revisions later than date.

date<= or >=date

Select all revisions on or later than date.

date

Select all revisions on date.

-h

Print only the header information for a file, not the description, the log messages, or revision information.

-l

Run log on the local directory only. (Do not recurse down subdirectories.)

-N

Do not list the tags (the symbolic names).

-r[revisions]

Provide information only on revisions in the ranges provided. More than one range can be given; ranges must be separated by commas. There must be no space between the -r and its argument. If no range is provided, the latest revision on the default branch, normally the trunk, is used.

Ranges can be specified according to the following list:

revision1:revision2 or revision1::revision2

Select all revisions between revision1 and revision2. The revisions must be on the same branch. With the double colon, CVS excludes revision1.

:revision or ::revision

Select revisions from the start of the branch or trunk the revision is on, up to and including the revision.

revision: or revision::

Select revisions from revision to the end of the branch or trunk the revision is on. With the double colon, CVS excludes the revision.

branch

Select all revisions on branch.

branch1:branch2 or branch1::branch2

Select all revisions on both branches and any branches that split off from the two branches.

branch.

Select the latest revision on branch.

-R

Display the name of the repository copy of a file only.

-s states

Display only revisions with states that match one of the states in the comma-separated list.

-S

Do not display header information if there are no revisions to display.

-t

Print only the header information and description, not the log messages or revision information.

-w[usernames]

Display only revisions committed by the specified list of users. Provide the list of users as a comma-separated list. If no usernames are listed, the revisions committed by the current user are displayed. There can be no space between -w and its argument.

Example

bash-2.05a$ cvs log
cvs server: Logging .
   
RCS file: /var/lib/cvs/wizzard/Changelog,v
Working file: Changelog
head: 1.1
branch:
locks: strict
access list:
symbolic names:
     beta_0-1_branch: 1.1.0.2
     beta_0-1_branch_root: 1.1
     pre_beta_0-1: 1.1
keyword substitution: kv
total revisions: 1;     selected revisions: 1
description:
----------------------------
revision 1.1
date: 2002/08/31 13:37:56;  author: jenn;  state: Exp;
Creating a structure.
.
.
.
login Synonyms: none

cvs [cvs-options] login

Logs in to a CVS pserver session.This command is needed only with the pserver connection mode.

See also logout

Example

bash-2.05a$ cvs -d :pserver:jenn:password:@cvs.nosuch.net:/var/lib/cvs login
Logging in to :pserver:jenn@cvs:2401/var/lib/cvs
logout Synonyms: none

cvs [cvs-options] logout

Logs out of a CVS pserver session. This command is needed only with the pserver connection mode.

See also login.

Example

bash-2.05a$ cvs -d :pserver:jenn@cvs:/var/lib/cvs logout
Logging out of :pserver:jenn@cvs:2401/var/lib/cvs
pserver Synonyms: none

cvs [cvs-options] pserver

Runs the repository-server end of a password server or Kerberos 5 (via the GSS-API) connection. This command must be called from inetd or an equivalent server daemon. See Chapter 8.

See also kserver.

Example

#inetd.conf
#:OTHER: Other services
2401 stream tcp nowait root /usr/bin/cvs cvs -f --allow-root=/var/lib/cvsroot pserver
rannotate Synonyms: ra, rann

cvs [cvs-options] rannotate [-fFlR] [-D date] [-r revision] files...

Displays files with annotations showing the last editor and revision that changed each line of each specified file. You can run rannotate without a sandbox, but you must have a repository specified if you do so. rannotate requires at least one filename, directory name, or module name from within the repository as an argument.

See also annotate.

Command options

-D date

Run rannotate on the latest revision of a file that is as old as or older than the date or time specified by date.

-f

Use the latest (HEAD) revision on the current branch or trunk if no revision matches the date or revision number. This applies only if -r or -D is used.

-F

Show annotations for binary files.

-l

Run rannotate on files in the local directory only. (Do not recurse into subdirectories.)

-r revision

Run rannotate on the specified revision or tag of a file. If the revision or tag refers to a branch, run the command on the latest (HEAD) revision of the branch.

-R

Run rannotate on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

Example

bash-2.05a$ cvs rannotate wizzard/Makefile
   
Annotations for wizzard/Makefile
***************
1.2  (jenn     01-Sep-02): #
1.2  (jenn     01-Sep-02): # Makefile for the Wizzard project
1.2  (jenn     01-Sep-02): # Created by J Vesperman, 1 September 2002
rdiff Synonyms: pa, patch

cvs [cvs-options] rdiff [-flR] [-c|-u] [-s|-t] {-r revision|-D date} 
[-r revision2 | -D date2] [-V version] projects...

Creates output that can be redirected into a file and used with the GNU (or equivalent) patch program. The output goes to the standard output (stdout). rdiff operates directly from the repository and does not need to be used from a sandbox. It does require a filename, directory name, or module name as an argument, and you must specify one or two revisions or dates. If you specify one revision or date, rdiff calculates the differences between that date and the current (HEAD) revision. If two dates are specified, rdiff calculates the differences between the two.

See also diff.

Most people use rdiff to make a file to use with patch. If you're using a patch file that was created over more than one directory, you may need to use the -p option to patch, so it can find all the appropriate directories.

Command options

-c

Use context output format, with three lines of context around each change. This is the default format.

-D date

Display the differences between the current sandbox copy of a file and the latest revision as of the date or time specified by date.

-f

Use the latest (HEAD) revision of a file on the current branch or trunk if no revision matches the date or revision number. This option applies only if -r or -D is used.

-l

Run rdiff on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-r revision

Display the differences between the current sandbox copy and the specified revision.

-R

Run rdiff on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

-s

Create a summary change report rather than a patch, showing which files have changed with one line per file.

-t

Produce a report on the two most recent revisions in a file. Do not use -r or -D with the -t option.

-u

Use unidiff format instead of context format.

-V version

This option is now obsolete, but it used to allow you to expand keywords according to the rules of the specified RCS version.

Example

bash-2.05a$ cvs rdiff -r 1.5 wizzard/Makefile
Index: wizzard/Makefile
diff -c wizzard/Makefile:1.5 wizzard/Makefile:1.6
*** wizzard/Makefile:1.5     Thu Oct 17 08:50:14 2002
--- wizzard/Makefile         Thu Oct 17 10:01:12 2002
***************
*** 2,17 ****
  # Makefile for the Wizzard project
  # First created by J Vesperman, 1 September 2002
  #
! # Current revision $Revision: 1.6 $
  # On branch $Name:  $ (not expanded if this is the trunk)
! # Latest change by $Author: madd $ on $Date: 2003/07/11 20:00:25 $
  #
  ##
  
  # Initial declarations
  #
  CC=gcc
! SUBDIRS = man doc src lib test
  
  
  # Declaring phony targets
--- 2,17 ----
  # Makefile for the Wizzard project
  # First created by J Vesperman, 1 September 2002
  #
! # Current revision $Revision: 1.6 $
  # On branch $Name:  $ (not expanded if this is the trunk)
! # Latest change by $Author: madd $ on $Date: 2003/07/11 20:00:25 $
  #
  ##
  
  # Initial declarations
  #
  CC=gcc
! SUBDIRS = man doc src lib
  
  
  # Declaring phony targets
***************
.
.
.
release Synonyms: re, rel

cvs [cvs-options] release [-d] directories...

Makes a sandbox inactive. This command checks for uncommitted changes, removing any existing edit flags, and writes to the CVSROOT/history file that the sandbox has been released. You can use release on an entire sandbox or on one or more subdirectories.

Command option

-d

Delete the sandbox after it has been released.

Example

bash-2.05a$ cvs -d cvs:/var/lib/cvs release wizzard
You have [0] altered files in this repository.
Are you sure you want to release directory `wizzard': y
remove Synonyms: rm, delete

cvs [cvs-options] remove [-flR] [files...]

The remove command removes a file or directory from the repository. It can also be used to undo an uncommitted file addition.

Command options

-f

Delete the files from the sandbox before removing them from the repository.

-l

Remove files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-R

Remove files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Example

bash-2.05a$ cvs remove server.cc
cvs server: scheduling `server.cc' for removal
cvs server: use 'cvs commit' to remove this file permanently
rlog Synonym: rl

cvs [cvs-options] rlog [-bhlNRSt] [-d dates] [-r[revisions]] [-s states]
[-w[usernames]] files...

The rlog command is a remote version of the log command. rlog works without a sandbox and requires a file, directory, or module name from the repository.

See also log.

Command options

-b

Provide information only about the revisions or a file on the default branch, normally the highest branch on the trunk.

-d dates

Provide information only on revisions of a file that were checked in on or between the dates or times provided. Date formats are listed Chapter 11. More than one date range can be given; ranges must be separated by semicolons. Date ranges can be specified according to the following list:

date1>date2 or date2<date1

Select all revisions between the two dates.

date1>=date2 or date2<=date1

Select all revisions on or between the two dates.

date> or <date

Select all revisions earlier than date.

date>= or <=date>

Select all revisions on or earlier than date.

date< or >date

Select all revisions later than date.

date<= or >=date

Select all revisions on or later than date.

date

Select all revisions on date.

-h

Print only the header information, not the description, log messages, or revision information.

-l

Run rlog on the local directory only. (Do not recurse into subdirectories.)

-N

Do not list the tags (the symbolic names).

-r[revisions]

Provide only information on revisions in the ranges provided. More than one revision range can be given; ranges must be separated by commas. There must be no space between the -r and its argument. If no range is provided, the latest revision on the default branch, normally the trunk, is used.

Ranges can be specified according to the following list:

revision1:revision2 or revision1::revision2

Select all revisions between revision1 and revision2. The revisions must be on the same branch. With the double colon, revision1 is excluded.

:revision or ::revision

Select revisions from the start of the branch or trunk the revision is on, up to and including the revision.

revision: or revision::

Select revisions from revision to the end of the branch or trunk it is on. With the double colon, the revision is excluded.

branch

Select all revisions on the branch.

branch1:branch2 or branch1::branch2

Select all revisions on both branches and any branches that split off between those two branches.

branch.

Select the latest revision on the branch.

-R

Display the name of the repository copy of the file only.

-s states

Display only revisions with states that match one of the states in the comma-separated list.

-S

Do not display header information of a file if there are no revisions to display.

-t

Print only the header information of a file and its description, not the log messages or revision information.

-w[usernames]

Display only revisions committed by the usernames in the comma-separated list. If there are no usernames listed, the revisions committed by the current user are displayed. There can be no space between -w and its argument.

Example

bash-2.05a$ cvs -d cvs:/var/lib/cvs rlog wizzard
cvs rlog: Logging wizzard
   
RCS file: /var/lib/cvs/wizzard/Changelog,v
head: 1.1
branch:
locks: strict
access list:
symbolic names:
     beta_0-1_branch: 1.1.0.2
     beta_0-1_branch_root: 1.1
     pre_beta_0-1: 1.1
keyword substitution: kv
total revisions: 1;     selected revisions: 1
description:
.
.
.
rtag Synonyms: rt, rfreeze

cvs [cvs-options] rtag [-abBdfFlnR] {-D date|-r revision} tagname files...

Marks a revision of a single file with a meaningful name or marks a set of revisions of multiple files so that they can all be retrieved easily as a group.

See also tag.

Command options

-a

Clear a tag from files that have been removed from active development. Normally, removed files are not searched when tags are removed. This option works with the -d and -F options.

-b

Create a branch off the designated revision, using the designated tagname as the branch name. Chapter 4 explains branches and their uses.

-B

Allow -F and -d to act on branch tags. Back up the repository before you use this option, and be extremely careful. I strongly recommend reading Chapter 4 before using this option.

-d

Delete the specified tag.

-D date

Tag the latest revision of each file that is as old as or older than the date or time specified by date.

-f

Use the latest (HEAD) revision on the current branch or trunk if no revision matches the date or revision number.

-F

Move the tag from the revision it currently refers to, to the revision specified in the rtag command.

-l

Run rtag on files in the local directory only. (Do not recurse into subdirectories.)

See also -R.

-n

Do not run any program listed in the appropriate line of the modules file of the repository's CVSROOT directory.

-r revision

Run rtag on the specified revision or tag. If revision refers to a branch, run the command on the latest (HEAD) revision of the branch.

-R

Run rtag on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Description

Use rtag to mark a revision of a single file with a meaningful name or to mark a set of revisions of multiple files so that they can all be retrieved easily as a group. Tagnames must begin with a letter and may contain only alphanumeric characters, underscores (_), and hyphens (-). There are two tags reserved for CVS: the BASE and HEAD tags.

The tag and rtag commands are also used to create branches. Branches and tags are explained in Chapter 4.

The rtag command does not need to run from a sandbox, but it does need to have a revision or date specified. It also requires a filename, directory name, or module name given as a parameter.

Example

bash-2.05a$ cvs -d cvs:/var/lib/cvs rtag -D now alpha_1-6 wizzard
cvs rtag: Tagging wizzard
cvs rtag: Tagging wizzard/doc
cvs rtag: Tagging wizzard/doc/design
cvs rtag: Tagging wizzard/doc/plan
.
.
.
server Synonyms: none

The server command is used internally by CVS; the client is invoked by the CVS client when the client connects to the repository computer via the ext or server access methods.

See also kserver and pserver.

status Synonyms: st, stat

cvs [cvs-options] status [-vlR] [files...]

Displays information about files, such as the current working or base revision, the current revision in the repository, and whether the files are currently synchronized with the repository. With the -v option, status also shows the files' tags.

Command options

-l

Run status on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-R

Run status on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

-v

Include information about tags.

Example

bash-2.05a$ cvs status Makefile
=  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =  =
File: Makefile              Status: Locally Modified
   
   Working revision:    1.6
   Repository revision: 1.6     /var/lib/cvs/wizzard/Makefile,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)
tag Synonyms: ta, freeze

cvs [cvs-options] tag [-bcdfFlR] [-D date|-r revision] tagname [files...]

Marks a revision of a single file with a meaningful name or marks a set of revisions of multiple files so that they can all be retrieved easily as a group.

See also rtag.

Command options

-b

Create a branch off the specified revision, using the specified tagname as the branch name. Chapter 4 explains branches and their uses.

-c

Check whether the sandbox copies of the specified files have been modified since they were last synchronized with the repository. If they have been modified, do not tag them and display an error. If they are unmodified, tag them with the specified tagname. This option is useful when tagging the current sandbox revisions.

-d

Delete the specified tagname from a file.

-D date

Tag the latest revision of each specified file that is as old as or older than the date or time specified by date.

-f

Use the latest (HEAD) revision on the current branch or trunk if no revision matches the date, time, tag, or revision number. This applies only if -r or -D are used.

-F

Move the tagname from the revision it currently refers to, to the revision specified in the tag command.

-l

Run tag on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-r revision

Run tag on the specified revision or tag. If revision refers to a branch, run the command on the latest (HEAD) revision of the branch.

-R

Run tag on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Description

Use the tag command to mark a revision of a single file with a meaningful name or to mark a set of revisions of multiple files so that they can all be retrieved easily as a group. Tagnames must begin with a letter and may contain only alphanumeric characters, underscores (_), and hyphens (-). There are two tags reserved for CVS: the BASE and HEAD tags.

The tag and rtag commands are also used to create branches. Branches and tags are explained in Chapter 4.

If no revision number or date is given to the tag command, this command tags based on the most recent revision in the repository that was synchronized with the current sandbox directory (i.e., the most recently updated, checked-out, or commited revision). This revision can be seen as the working revision in the cvs status command.

Example

bash-2.05a$ cvs tag alpha_1-5
cvs server: Tagging .
T Changelog
T INSTALL
T Makefile
T README
T TODO
.
.
.
unedit Synonyms: none

cvs [cvs-options] unedit [-lR] [files...]

Notifies watchers that a file is no longer being edited, clears the temporary watch, sets the file as read-only, and restores the file to the repository revision that the sandbox copy was based on.

See also edit, editors, watch, and watchers.

Command options

-l

Run unedit on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-R

Run unedit on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Description

The cvs unedit command is used as part of the cvs watch family of commands. If a file is being watched, CVS writes it (when it is checked out) to the sandbox with read permissions but not write permissions. The edit command sets the sandbox file as writable, notifies any watchers that the file is being edited, and sets the user as a temporary watcher to be notified if certain actions are performed on the file by other users.

The unedit command notifies watchers that the file is no longer being edited, clears the temporary watch, sets the file as read-only, and restores the file to the repository revision that the sandbox copy was based on.

The script in the notify file in the repository's CVSROOT directory is used to notify the user of changes.

Example

bash-2.05a$ cvs unedit Makefile
bash-2.05a$
update Synonyms: up, upd

cvs [cvs-options] update  [-ACdflpPR] [-D date] [-I ignore] [-j revision [:date]] 
[-j revision2 [:date2]] [-k mode] [-r revision] [-W wrapper] [files...]

Downloads changes from the repository to an existing sandbox.

See also checkout and export.

Command options

-A

Clear sticky tags, dates, and keyword-expansion modes and replace the current files in a sandbox with the head of the trunk.

-C

Replace any file that has been changed locally with the revision from the repository that the local file was based on. The modified local file is saved as .#file.revision in its local sandbox directory.

-d

Create any directories that are in the repository but not in the sandbox. By default, update works only on the directories that are currently in the sandbox and ignores any new directories.

-D date

Check out the latest revision of each file that is as old as or older than the date or time specified by date. This produces a sticky date on the new sandbox.

-f

Use the latest (HEAD) revision on the current branch or trunk if no revision matches the date, time, tag, or revision number. This applies only if -r or -D are used.

-I ignore

Ignore the named file when updating. -I can be used more than once. Use -I ! to clear the list of ignored files. See Section 6.5.3.2 in Chapter 6.

-j revision[:date]

Determine the changes between the revision the files in the sandbox are based on and the specified revision and merge the changes to the sandbox.

If two -j options are used, determine the changes between the first -j revision and the second -j revision and merge those changes to the sandbox.

The date can be used only if the revision designates a branch. If date is used, it specifies the latest revision on (not before) that date.

-k mode

Update the files or sandbox with the designated keyword-expansion mode. This option also sets a sticky keyword mode for the files or the sandbox so that later commands operate with the same keyword-expansion mode unless a -k option overrides that mode. This option overrides the default mode for each file.

The keyword expansion modes are listed in Section 11.6 of Chapter 11.

-l

Run update on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-p

Update the listed files, but write them to the standard output (stdout) rather than to the filesystem. Do not change the sandbox.

-P

Do not include empty directories in the sandbox.

-r revision

Run update on the specified revision or tag. If revision refers to a branch, run the command on the latest (HEAD) revision of the branch. This produces a sticky tag on the new sandbox.

-R

Run update on the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

-W wrapper

Modify the update based on elements of each filename. Wrappers are explained in Chapter 3.

Description

The cvs update command brings changes from the repository to an existing sandbox. While doing this, update merges changes from the repository into changed files in the sandbox.

If update cannot merge repository changes with sandbox changes without losing data, it reports a conflict. Resolving conflicts is explained in Chapter 3.

If update is not given any filenames or directory names as parameters, it acts on the current sandbox.

Example

bash-2.05a$ cvs update
cvs server: Updating .
U wizzard/Changelog
U wizzard/INSTALL
U wizzard/Makefile
version Synonyms: ve, ver

cvs [cvs-options] version

Displays the version information for the current installation of CVS.

Example

$ cvs version
Client: Concurrent Versions System (CVS) 1.11.2 (client/server)
Server: Concurrent Versions System (CVS) 1.11.2 (client/server)
watch Synonyms: none

cvs [cvs-options] watch {on|off|add|remove} [-lR] [-a action] [files...]

Sets files to be watched or adds users to the file watch list. Users who are watching a file are notified via the script in the notify file in the repository's CVSROOT directory when other users perform specific actions. Chapter 5 explains uses of the cvs watch family of commands.

CVS does not notify you of your own changes.

See also edit, editors, unedit, and watchers.

Command options

on and off

The on and off subcommands control whether the file or files are marked as being watched. If a file is marked as being watched, CVS sets it as read-only when it is checked out of the repository. Without this read-only setting, your developers might forget to use cvs edit when editing a file.

If the argument is a directory, all current files in the directory and all new files added to that directory in the future are set as being watched.

The on and off subcommands set whether a file is watchable, but they do not set who is watching it.

add and remove

Use the add and remove subcommands to set or remove files you want to watch. Use the -a option to specify which actions you want to be notified of.

The add and remove subcommands set whether or not you are watching a file.

-a action

Notify the user when the designated actions occur to the file. Each -a designates one possible action. The -a option can be repeated to designate multiple actions. The -a option is usable only with the add and remove subcommands.

These are the possible actions:

edit

Notify the user if someone else has run cvs edit on the file.

unedit

Notify the user when the file is no longer being edited by someone else. Notification occurs when cvs unedit or cvs release runs or when the file is deleted and recreated with cvs update or cvs checkout.

commit

Notify the user when someone else commits changes to the file.

all

Notify the user in all of the previous cases.

none

Notify the user in none of the previous cases.

-l

Run watch on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-R

Run watch on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Example

bash-2.05a$ cvs watch on Makefile
bash-2.05a$ cvs watch add Makefile
watchers Synonyms: none

cvs [cvs-options] watchers [-lR] [files...]

Displays the list of users who are watching the files listed as parameters. If no files are listed, this command lists the watchers for the files in the current directory and its subdirectories.

See also edit, editors, unedit, and watch.

Command options

-l

Run watchers on files in the local directory only. (Do not recurse down subdirectories.)

See also -R.

-R

Run watchers on files in the local directory and all subdirectories and recurse down the subdirectories. This option is the default.

See also -l.

Example

bash-2.05a$ cvs watchers Makefile
Makefile doppel edit unedit commit
         jenn edit unedit commit

  Previous section   Next section
Top