cvs (1) Linux Manual Page
NAME
cvs – Concurrent Versions System
SYNOPSIS
cvs[ cvs_options ]- cvs_command [ command_options ] [ command_args ]
NOTE
This manpage is a summary of some of the features of cvs. It is auto-generated from an appendix of the CVS manual. For more in-depth documentation, please consult the Cederqvist manual (via the info CVS command or otherwise, as described in the SEE ALSO section of this manpage). Cross-references in this man page refer to nodes in the same.
CVS commands
Guide to CVS commands
This appendix describes the overall structure of cvs commands, and describes some commands in detail (others are described elsewhere; for a quick reference to cvs commands, see node `Invoking CVS’ in the CVS manual).
Structure
Overall structure of CVS commands
The overall format of all cvs commands is:
- cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ]
-
cvs - The name of the
cvsprogram. -
cvs_options - Some options that affect all sub-commands of
cvs. These are described below. -
cvs_command - One of several different sub-commands. Some of the commands have aliases that can be used instead; those aliases are noted in the reference manual for that command. There are only two situations where you may omit
cvs_command:cvs -Helicits a list of available commands, andcvs -vdisplays version information oncvsitself. -
command_options - Options that are specific for the command.
-
command_args - Arguments to the commands.
There is unfortunately some confusion between
cvs_optionsandcommand_options. When given as acvs_option, some options only affect some of the commands. When given as acommand_optionit may have a different meaning, and be accepted by more commands. In other words, do not take the above categorization too seriously. Look at the documentation instead.
Exit status
CVS’s exit status
cvs can indicate to the calling environment whether it succeeded or failed by setting its exit status. The exact way of testing the exit status will vary from one operating system to another. For example in a unix shell script the $? variable will be 0 if the last command returned a successful exit status, or greater than 0 if the exit status indicated failure.
If cvs is successful, it returns a successful status; if there is an error, it prints an error message and returns a failure status. The one exception to this is the cvs diff command. It will return a successful status if it found no differences, or a failure status if there were differences or if there was an error. Because this behavior provides no good way to detect errors, in the future it is possible that cvs diff will be changed to behave like the other cvs commands.
~/.cvsrc
Default options and the ~/.cvsrc file
There are some command_options that are used so often that you might have set up an alias or some other means to make sure you always specify that option. One example (the one that drove the implementation of the .cvsrc support, actually) is that many people find the default output of the diff command to be very hard to read, and that either context diffs or unidiffs are much easier to understand.
The ~/.cvsrc file is a way that you can add default options to cvs_commands within cvs, instead of relying on aliases or other shell scripts.
The format of the ~/.cvsrc file is simple. The file is searched for a line that begins with the same name as the cvs_command being executed. If a match is found, then the remainder of the line is split up (at whitespace characters) into separate options and added to the command arguments before any options from the command line.
If a command has two names (e.g., checkout and co), the official name, not necessarily the one used on the command line, will be used to match against the file. So if this is the contents of the user’s ~/.cvsrc file:
- log -N
- diff -uN
- rdiff -u
- update -Pd
- checkout -P
- release -d
-
the command
cvs checkout foowould have the-Poption added to the arguments, as well ascvs co foo.With the example file above, the output from
cvs diff foobarwill be in unidiff format.cvs diff -c foobarwill provide context diffs, as usual. Getting "old" format diffs would be slightly more complicated, becausediffdoesn’t have an option to specify use of the "old" format, so you would needcvs -f diff foobar.In place of the command name you can use
cvsto specify global options (see node `Global options’ in the CVS manual). For example the following line in.cvsrc - cvs -z6
-
causes
cvsto use compression level 6.
Global options
The available cvs_options (that are given to the left of cvs_command) are:
-
–allow-root=rootdir - Specify legal
cvsrootdirectory. See `Password authentication server’ in the CVS manual. -
-a - Authenticate all communication between the client and the server. Only has an effect on the
cvsclient. As of this writing, this is only implemented when using a GSSAPI connection (see node `GSSAPI authenticated’ in the CVS manual). Authentication prevents certain sorts of attacks involving hijacking the activetcpconnection. Enabling authentication does not enable encryption. -
-bbindir - In
cvs1.9.18 and older, this specified thatrcsprograms are in the bindir directory. Current versions ofcvsdo not runrcsprograms; for compatibility this option is accepted, but it does nothing. -
-Ttempdir - Use tempdir as the directory where temporary files are located. Overrides the setting of the
$TMPDIRenvironment variable and any precompiled directory. This parameter should be specified as an absolute pathname. (When running client/server,-Taffects only the local process; specifying-Tfor the client has no effect on the server and vice versa.) -
-dcvs_root_directory - Use cvs_root_directory as the root directory pathname of the repository. Overrides the setting of the
$CVSROOTenvironment variable. See `Repository’ in the CVS manual. -
-eeditor - Use editor to enter revision log information. Overrides the setting of the
$CVSEDITORand$EDITORenvironment variables. For more information, see `Committing your changes’ in the CVS manual. -
-f - Do not read the
~/.cvsrcfile. This option is most often used because of the non-orthogonality of thecvsoption set. For example, thecvs logoption-N(turn off display of tag names) does not have a corresponding option to turn the display on. So if you have-Nin the~/.cvsrcentry forlog, you may need to use-fto show the tag names. -
-H -
–help - Display usage information about the specified
cvs_command(but do not actually execute the command). If you don’t specify a command name,cvs -Hdisplays overall help forcvs, including a list of other help options. -
-n - Do not change any files. Attempt to execute the
cvs_command, but only to issue reports; do not remove, update, or merge any existing files, or create any new files.Note that
cvswill not necessarily produce exactly the same output as without-n. In some cases the output will be the same, but in other casescvswill skip some of the processing that would have been required to produce the exact same output. -
-Q - Cause the command to be really quiet; the command will only generate output for serious problems.
-
-q - Cause the command to be somewhat quiet; informational messages, such as reports of recursion through subdirectories, are suppressed.
-
-r - Make new working files read-only. Same effect as if the
$CVSREADenvironment variable is set (see node `Environment variables’ in the CVS manual). The default is to make working files writable, unless watches are on (see node `Watches’ in the CVS manual). -
-svariable=value - Set a user variable (see node `Variables’ in the CVS manual).
-
-t - Trace program execution; display messages showing the steps of
cvsactivity. Particularly useful with-nto explore the potential impact of an unfamiliar command. -
-v -
–version - Display version and copyright information for
cvs. -
-w - Make new working files read-write. Overrides the setting of the
$CVSREADenvironment variable. Files are created read-write by default, unless$CVSREADis set or-ris given. -
-x - Encrypt all communication between the client and the server. Only has an effect on the
cvsclient. As of this writing, this is only implemented when using a GSSAPI connection (see node `GSSAPI authenticated’ in the CVS manual) or a Kerberos connection (see node `Kerberos authenticated’ in the CVS manual). Enabling encryption implies that message traffic is also authenticated. Encryption support is not available by default; it must be enabled using a special configure option,–enable-encryption, when you buildcvs. -
-zgzip-level - Set the compression level. Valid levels are 1 (high speed, low compression) to 9 (low speed, high compression), or 0 to disable compression (the default). Only has an effect on the
cvsclient.
Common options
Common command options
This section describes the command_options that are available across several cvs commands. These options are always given to the right of cvs_command. Not all commands support all of these options; each option is only supported for commands where it makes sense. However, when a command has one of these options you can almost always count on the same behavior of the option as in other commands. (Other command options, which are listed with the individual commands, may have different behavior from one cvs command to the other).
The history command is an exception; it supports many options that conflict even with these standard options.
-
-Ddate_spec - Use the most recent revision no later than date_spec. date_spec is a single argument, a date description specifying a date in the past.
The specification is sticky when you use it to make a private copy of a source file; that is, when you get a working file using
-D,cvsrecords the date you specified, so that further updates in the same directory will use the same date (for more information on sticky tags/dates, see node `Sticky tags’ in the CVS manual).-Dis available with theannotate,checkout,diff,export,history,rdiff,rtag, andupdatecommands. (Thehistorycommand uses this option in a slightly different way; see node `history options’ in the CVS manual).A wide variety of date formats are supported by
cvs. The most standard ones are ISO8601 (from the International Standards Organization) and the Internet e-mail standard (specified in RFC822 as amended by RFC1123).ISO8601 dates have many variants but a few examples are:
- 1972-09-24
- 1972-09-24 20:05
-
There are a lot more ISO8601 date formats, and
cvsaccepts many of them, but you probably don’t want to hear the whole long story :-).In addition to the dates allowed in Internet e-mail itself,
cvsalso allows some of the fields to be omitted. For example: - 24 Sep 1972 20:05
- 24 Sep
-
The date is interpreted as being in the local timezone, unless a specific timezone is specified.
These two date formats are preferred. However,
cvscurrently accepts a wide variety of other date formats. They are intentionally not documented here in any detail, and future versions ofcvsmight not accept all of them.One such format is month
/day/year. This may confuse people who are accustomed to having the month and day in the other order;1/4/96is January 4, not April 1.Remember to quote the argument to the
-Dflag so that your shell doesn’t interpret spaces as argument separators. A command using the-Dflag can look like this: - $ cvs diff -D "1 hour ago" cvs.texinfo
-
-f - When you specify a particular date or tag to
cvscommands, they normally ignore files that do not contain the tag (or did not exist prior to the date) that you specified. Use the-foption if you want files retrieved even when there is no match for the tag or date. (The most recent revision of the file will be used).Note that even with
-f, a tag that you specify must exist (that is, in some file, not necessary in every file). This is so thatcvswill continue to give an error if you mistype a tag name.-fis available with these commands:annotate,checkout,export,rdiff,rtag, andupdate.WARNING: The commit and remove commands also have a -f option, but it has a different behavior for those commands. See `commit options’ in the CVS manual, and `Removing files’ in the CVS manual. -
-kkflag - Alter the default processing of keywords. See `Keyword substitution’ in the CVS manual, for the meaning of kflag. Your kflag specification is sticky when you use it to create a private copy of a source file; that is, when you use this option with the
checkoutorupdatecommands,cvsassociates your selected kflag with the file, and continues to use it with future update commands on the same file until you specify otherwise.The
-koption is available with theadd,checkout,diff,rdiff,importandupdatecommands. -
-l - Local; run only in current working directory, rather than recursing through subdirectories.
Available with the following commands:
annotate,checkout,commit,diff,edit,editors,export,log,rdiff,remove,rtag,status,tag,unedit,update,watch, andwatchers. -
-mmessage - Use message as log information, instead of invoking an editor.
Available with the following commands:
add,commitandimport. -
-n - Do not run any tag program. (A program can be specified to run in the modules database (see node `modules’ in the CVS manual); this option bypasses it).
This is not the same as the cvs -n program option, which you can specify to the left of a cvs command!Available with the
checkout,export, andrtagcommands. -
-P - Prune empty directories. See `Removing directories’ in the CVS manual.
-
-p - Pipe the files retrieved from the repository to standard output, rather than writing them in the current directory. Available with the
checkoutandupdatecommands. -
-R - Process directories recursively. This is on by default.
Available with the following commands:
annotate,checkout,commit,diff,edit,editors,export,rdiff,remove,rtag,status,tag,unedit,update,watch, andwatchers. -
-rtag - Use the revision specified by the tag argument instead of the default head revision. As well as arbitrary tags defined with the
tagorrtagcommand, two special tags are always available:HEADrefers to the most recent version available in the repository, andBASErefers to the revision you last checked out into the current working directory.The tag specification is sticky when you use this with
checkoutorupdateto make your own copy of a file:cvsremembers the tag and continues to use it on future update commands, until you specify otherwise (for more information on sticky tags/dates, see node `Sticky tags’ in the CVS manual).The tag can be either a symbolic or numeric tag, as described in `Tags’ in the CVS manual, or the name of a branch, as described in `Branching and merging’ in the CVS manual. When a command expects a specific revision, the name of a branch is interpreted as the most recent revision on that branch.
Specifying the
-qglobal option along with the-rcommand option is often useful, to suppress the warning messages when thercsfile does not contain the specified tag.This is not the same as the overall cvs -r option, which you can specify to the left of a cvs command!-ris available with theannotate,checkout,commit,diff,history,export,rdiff,rtag, andupdatecommands. -
-W - Specify file names that should be filtered. You can use this option repeatedly. The spec can be a file name pattern of the same type that you can specify in the
.cvswrappersfile. Available with the following commands:import, andupdate.
add
Add files and directories to the repository
- •
- Synopsis: add [-k rcs-kflag] [-m message] files…
- •
- Requires: repository, working directory.
- •
- Changes: repository, working directory.
The
addcommand is used to present new files and directories for addition into thecvsrepository. Whenaddis used on a directory, a new directory is created in the repository immediately. When used on a file, only the working directory is updated. Changes to the repository are not made until thecommitcommand is used on the newly added file.The
addcommand also resurrects files that have been previously removed. This can be done before or after thecommitcommand is used to finalize the removal of files. Resurrected files are restored into the working directory at the time theaddcommand is executed.
add options
These standard options are supported by add (see node `Common options’ in the CVS manual, for a complete description of them):
-
-kkflag - Process keywords according to kflag. See `Keyword substitution’ in the CVS manual. This option is sticky; future updates of this file in this working directory will use the same kflag. The
statuscommand can be viewed to see the sticky options. For more information on thestatuscommand, see node `Invoking CVS’ in the CVS manual. -
-mmessage - Use message as the log message, instead of invoking an editor.
add examples
Adding a directory
- $ mkdir doc
- $ cvs add doc
- Directory /path/to/repository/doc added to the repository
Adding a file
- $ >TODO
- $ cvs add TODO
- cvs add: scheduling file `TODO’ for addition
- cvs add: use ‘cvs commit’ to add this file permanently
Undoing a remove command
- $ rm -f makefile
- $ cvs remove makefile
- cvs remove: scheduling `makefile’ for removal
- cvs remove: use ‘cvs commit’ to remove this file permanently
- $ cvs add makefile
- U makefile
- cvs add: makefile, version 1.2, resurrected
admin
Administration
- •
- Requires: repository, working directory.
- •
- Changes: repository.
- •
- Synonym: rcs
This is the
cvsinterface to assorted administrative facilities. Some of them have questionable usefulness forcvsbut exist for historical purposes. Some of the questionable options are likely to disappear in the future. This command does work recursively, so extreme care should be used.On unix, if there is a group named
cvsadmin, only members of that group can runcvs admin(except for thecvs admin -kcommand, which can be run by anybody). This group should exist on the server, or any system running the non-client/servercvs. To disallowcvs adminfor all users, create a group with no users in it. On NT, thecvsadminfeature does not exist and all users can runcvs admin.
admin options
Some of these options have questionable usefulness for cvs but exist for historical purposes. Some even make it impossible to use cvs until you undo the effect!
-
-Aoldfile - Might not work together with
cvs. Append the access list of oldfile to the access list of thercsfile. -
-alogins - Might not work together with
cvs. Append the login names appearing in the comma-separated list logins to the access list of thercsfile. -
-b[rev] - Set the default branch to rev. In
cvs, you normally do not manipulate default branches; sticky tags (see node `Sticky tags’ in the CVS manual) are a better way to decide which branch you want to work on. There is one reason to runcvs admin -b: to revert to the vendor’s version when using vendor branches (see node `Reverting local changes’ in the CVS manual). There can be no space between-band its argument. -
-cstring - Sets the comment leader to string. The comment leader is not used by current versions of
cvsorrcs5.7. Therefore, you can almost surely not worry about it. See `Keyword substitution’ in the CVS manual. -
-e[logins] - Might not work together with
cvs. Erase the login names appearing in the comma-separated list logins from the access list of the RCS file. If logins is omitted, erase the entire access list. There can be no space between-eand its argument. -
-I - Run interactively, even if the standard input is not a terminal. This option does not work with the client/server
cvsand is likely to disappear in a future release ofcvs. -
-i - Useless with
cvs. This creates and initializes a newrcsfile, without depositing a revision. Withcvs, add files with thecvs addcommand (see node `Adding files’ in the CVS manual). -
-ksubst - Set the default keyword substitution to subst. See `Keyword substitution’ in the CVS manual. Giving an explicit
-koption tocvs update,cvs export, orcvs checkoutoverrides this default. -
-l[rev] - Lock the revision with number rev. If a branch is given, lock the latest revision on that branch. If rev is omitted, lock the latest revision on the default branch. There can be no space between
-land its argument.This can be used in conjunction with the
rcslock.plscript in thecontribdirectory of thecvssource distribution to provide reserved checkouts (where only one user can be editing a given file at a time). See the comments in that file for details (and see theREADMEfile in that directory for disclaimers about the unsupported nature of contrib). According to comments in that file, locking must set to strict (which is the default). -
-L - Set locking to strict. Strict locking means that the owner of an RCS file is not exempt from locking for checkin. For use with
cvs, strict locking must be set; see the discussion under the-loption above. -
-mrev:msg - Replace the log message of revision rev with msg.
-
-Nname[:[rev]] - Act like
-n, except override any previous assignment of name. For use with magic branches, see `Magic branch numbers’ in the CVS manual. -
-nname[:[rev]] - Associate the symbolic name name with the branch or revision rev. It is normally better to use
cvs tagorcvs rtaginstead. Delete the symbolic name if both:and rev are omitted; otherwise, print an error message if name is already associated with another number. If rev is symbolic, it is expanded before association. A rev consisting of a branch number followed by a.stands for the current latest revision in the branch. A:with an empty rev stands for the current latest revision on the default branch, normally the trunk. For example,cvs admin -nname:associates name with the current latest revision of all the RCS files; this contrasts withcvs admin -nname:$which associates name with the revision numbers extracted from keyword strings in the corresponding working files. -
-orange - Deletes (outdates) the revisions given by range.
Note that this command can be quite dangerous unless you know exactly what you are doing (for example see the warnings below about how the rev1:rev2 syntax is confusing).
If you are short on disc this option might help you. But think twice before using it—there is no way short of restoring the latest backup to undo this command! If you delete different revisions than you planned, either due to carelessness or (heaven forbid) a
cvsbug, there is no opportunity to correct the error before the revisions are deleted. It probably would be a good idea to experiment on a copy of the repository first.Specify range in one of the following ways:
- rev1
::rev2 - Collapse all revisions between rev1 and rev2, so that
cvsonly stores the differences associated with going from rev1 to rev2, not intermediate steps. For example, after-o 1.3::1.5one can retrieve revision 1.3, revision 1.5, or the differences to get from 1.3 to 1.5, but not the revision 1.4, or the differences between 1.3 and 1.4. Other examples:-o 1.3::1.4and-o 1.3::1.3have no effect, because there are no intermediate revisions to remove. -
::rev - Collapse revisions between the beginning of the branch containing rev and rev itself. The branchpoint and rev are left intact. For example,
-o ::1.3.2.6deletes revision 1.3.2.1, revision 1.3.2.5, and everything in between, but leaves 1.3 and 1.3.2.6 intact. - rev
:: - Collapse revisions between rev and the end of the branch containing rev. Revision rev is left intact but the head revision is deleted.
- rev
- Delete the revision rev. For example,
-o 1.3is equivalent to-o 1.2::1.4. - rev1
:rev2 - Delete the revisions from rev1 to rev2, inclusive, on the same branch. One will not be able to retrieve rev1 or rev2 or any of the revisions in between. For example, the command
cvs admin -oR_1_01:R_1_02 .is rarely useful. It means to delete revisions up to, and including, the tag R_1_02. But beware! If there are files that have not changed between R_1_02 and R_1_03 the file will have the same numerical revision number assigned to the tags R_1_02 and R_1_03. So not only will it be impossible to retrieve R_1_02; R_1_03 will also have to be restored from the tapes! In most cases you want to specify rev1::rev2 instead. -
:rev - Delete revisions from the beginning of the branch containing rev up to and including rev.
- rev
: - Delete revisions from revision rev, including rev itself, to the end of the branch containing rev.
None of the revisions to be deleted may have branches or locks.
If any of the revisions to be deleted have symbolic names, and one specifies one of the
::syntaxes, thencvswill give an error and not delete any revisions. If you really want to delete both the symbolic names and the revisions, first delete the symbolic names withcvs tag -d, then runcvs admin -o. If one specifies the non-::syntaxes, thencvswill delete the revisions but leave the symbolic names pointing to nonexistent revisions. This behavior is preserved for compatibility with previous versions ofcvs, but because it isn’t very useful, in the future it may change to be like the::case.Due to the way
cvshandles branches rev cannot be specified symbolically if it is a branch. See `Magic branch numbers’ in the CVS manual for an explanation.Make sure that no-one has checked out a copy of the revision you outdate. Strange things will happen if he starts to edit it and tries to check it back in. For this reason, this option is not a good way to take back a bogus commit; commit a new revision undoing the bogus change instead (see node `Merging two revisions’ in the CVS manual).
-
-q - Run quietly; do not print diagnostics.
-
-sstate[:rev] - Useful with
cvs. Set the state attribute of the revision rev to state. If rev is a branch number, assume the latest revision on that branch. If rev is omitted, assume the latest revision on the default branch. Any identifier is acceptable for state. A useful set of states isExp(for experimental),Stab(for stable), andRel(for released). By default, the state of a new revision is set toExpwhen it is created. The state is visible in the output from cvs log (see node `log’ in the CVS manual), and in the$Log$ and$State$ keywords (see node `Keyword substitution’ in the CVS manual). Note thatcvsuses thedeadstate for its own purposes (see node `Attic’ in the CVS manual); to take a file to or from thedeadstate use commands likecvs removeandcvs add(see node `Adding and removing’ in the CVS manual), notcvs admin -s. -
-t[file] - Useful with
cvs. Write descriptive text from the contents of the named file into the RCS file, deleting the existing text. The file pathname may not begin with–. The descriptive text can be seen in the output fromcvs log(see node `log’ in the CVS manual). There can be no space between-tand its argument.If file is omitted, obtain the text from standard input, terminated by end-of-file or by a line containing
.by itself. Prompt for the text if interaction is possible; see-I. -
-t-string - Similar to
-tfile. Write descriptive text from the string into thercsfile, deleting the existing text. There can be no space between-tand its argument. -
-U - Set locking to non-strict. Non-strict locking means that the owner of a file need not lock a revision for checkin. For use with
cvs, strict locking must be set; see the discussion under the-loption above. -
-u[rev] - See the option
-labove, for a discussion of using this option withcvs. Unlock the revision with number rev. If a branch is given, unlock the latest revision on that branch. If rev is omitted, remove the latest lock held by the caller. Normally, only the locker of a revision may unlock it; somebody else unlocking a revision breaks the lock. This causes the original locker to be sent acommitnotification (see node `Getting Notified’ in the CVS manual). There can be no space between-uand its argument. -
-Vn - In previous versions of
cvs, this option meant to write anrcsfile which would be acceptable torcsversion n, but it is now obsolete and specifying it will produce an error. -
-xsuffixes - In previous versions of
cvs, this was documented as a way of specifying the names of thercsfiles. However,cvshas always required that thercsfiles used bycvsend in,v, so this option has never done anything useful.
annotate
What revision modified each line of a file?
- •
- Synopsis: annotate [options] files…
- •
- Requires: repository.
- •
- Synonym: blame
- •
- Changes: nothing.
For each file in files, print the head revision of the trunk, together with information on the last modification for each line.
annotate options
These standard options are supported by annotate (see node `Common options’ in the CVS manual for a complete description of them):
-
-l - Local directory only, no recursion.
-
-R - Process directories recursively.
-
-f - Use head revision if tag/date not found.
-
-F - Annotate binary files.
-
-rrevision - Annotate file as of specified revision/tag.
-
-Ddate - Annotate file as of specified date.
annotate example
For example:
- $ cvs annotate ssfile
- Annotations for ssfile
- ***************
- 1.1 (mary 27-Mar-96): ssfile line 1
- 1.2 (joe 28-Mar-96): ssfile line 2
-
The file
ssfilecurrently contains two lines. Thessfile line 1line was checked in bymaryon March 27. Then, on March 28,joeadded a linessfile line 2, without modifying thessfile line 1line. This report doesn’t tell you anything about lines which have been deleted or replaced; you need to usecvs difffor that (see node `diff’ in the CVS manual).The options to
cvs annotateare listed in `Invoking CVS’ in the CVS manual, and can be used to select the files and revisions to annotate. The options are described in more detail there and in `Common options’ in the CVS manual.
checkout
Check out sources for editing
- •
- Synopsis: checkout [options] modules…
- •
- Requires: repository.
- •
- Changes: working directory.
- •
- Synonyms: co, get
Create or update a working directory containing copies of the source files specified by modules. You must execute
checkoutbefore using most of the othercvscommands, since most of them operate on your working directory.The modules are either symbolic names for some collection of source directories and files, or paths to directories or files in the repository. The symbolic names are defined in the
modulesfile. See `modules’ in the CVS manual.Depending on the modules you specify,
checkoutmay recursively create directories and populate them with the appropriate source files. You can then edit these source files at any time (regardless of whether other software developers are editing their own copies of the sources); update them to include new changes applied by others to the source repository; or commit your work as a permanent change to the source repository.Note that
checkoutis used to create directories. The top-level directory created is always added to the directory wherecheckoutis invoked, and usually has the same name as the specified module. In the case of a module alias, the created sub-directory may have a different name, but you can be sure that it will be a sub-directory, and thatcheckoutwill show the relative path leading to each file as it is extracted into your private work area (unless you specify the-Qglobal option).The files created by
checkoutare created read-write, unless the-roption tocvs(see node `Global options’ in the CVS manual) is specified, theCVSREADenvironment variable is specified (see node `Environment variables’ in the CVS manual), or a watch is in effect for that file (see node `Watches’ in the CVS manual).Note that running
checkouton a directory that was already built by a priorcheckoutis also permitted. This is similar to specifying the-doption to theupdatecommand in the sense that new directories that have been created in the repository will appear in your work area. However,checkouttakes a module name whereasupdatetakes a directory name. Also to usecheckoutthis way it must be run from the top level directory (where you originally rancheckoutfrom), so before you runcheckoutto update an existing directory, don’t forget to change your directory to the top level directory.For the output produced by the
checkoutcommand, see node `update output’ in the CVS manual.
checkout options
These standard options are supported by checkout (see node `Common options’ in the CVS manual for a complete description of them):
-
-Ddate - Use the most recent revision no later than date. This option is sticky, and implies
-P. See `Sticky tags’ in the CVS manual for more information on sticky tags/dates. -
-f - Only useful with the
-Ddate or-rtag flags. If no matching revision is found, retrieve the most recent revision (instead of ignoring the file). -
-kkflag - Process keywords according to kflag. See `Keyword substitution’ in the CVS manual. This option is sticky; future updates of this file in this working directory will use the same kflag. The
statuscommand can be viewed to see the sticky options. See `Invoking CVS’ in the CVS manual for more information on thestatuscommand. -
-l - Local; run only in current working directory.
-
-n - Do not run any checkout program (as specified with the
-ooption in the modules file; see node `modules’ in the CVS manual). -
-P - Prune empty directories. See `Moving directories’ in the CVS manual.
-
-p - Pipe files to the standard output.
-
-R - Checkout directories recursively. This option is on by default.
-
-rtag - Use revision tag. This option is sticky, and implies
-P. See `Sticky tags’ in the CVS manual, for more information on sticky tags/dates.In addition to those, you can use these special command options with
checkout: -
-A - Reset any sticky tags, dates, or
-koptions. Does not reset sticky-koptions on modified files. See `Sticky tags’ in the CVS manual for more information on sticky tags/dates. -
-c - Copy the module file, sorted, to the standard output, instead of creating or modifying any files or directories in your working directory.
-
-ddir - Create a directory called dir for the working files, instead of using the module name. In general, using this flag is equivalent to using
mkdirdir; cddir followed by the checkout command without the-dflag.There is an important exception, however. It is very convenient when checking out a single item to have the output appear in a directory that doesn’t contain empty intermediate directories. In this case only,
cvstries to “shorten” pathnames to avoid those empty directories.For example, given a module
foothat contains the filebar.c, the commandcvs co -d dir foowill create directorydirand placebar.cinside. Similarly, given a modulebarwhich has subdirectorybazwherein there is a filequux.c, the commandcvs co -d dir bar/bazwill create directorydirand placequux.cinside.Using the
-Nflag will defeat this behavior. Given the same module definitions above,cvs co -N -d dir foowill create directoriesdir/fooand placebar.cinside, whilecvs co -N -d dir bar/bazwill create directoriesdir/bar/bazand placequux.cinside. -
-jtag - With two
-joptions, merge changes from the revision specified with the first-joption to the revision specified with the secondjoption, into the working directory.With one
-joption, merge changes from the ancestor revision to the revision specified with the-joption, into the working directory. The ancestor revision is the common ancestor of the revision which the working directory is based on, and the revision specified in the-joption.In addition, each -j option can contain an optional date specification which, when used with branches, can limit the chosen revision to one within a specific date. An optional date is specified by adding a colon (:) to the tag:
-jSymbolic_Tag:Date_Specifier.See `Branching and merging’ in the CVS manual.
-
-N - Only useful together with
-ddir. With this option,cvswill not “shorten” module paths in your working directory when you check out a single module. See the-dflag for examples and a discussion. -
-s - Like
-c, but include the status of all modules, and sort it by the status string. See `modules’ in the CVS manual, for info about the-soption that is used inside the modules file to set the module status.
checkout examples
Get a copy of the module tc:
- $ cvs checkout tc
-
Get a copy of the module
tcas it looked one day ago: - $ cvs checkout -D yesterday tc
commit
Check files into the repository
- •
- Synopsis: commit [-lRf] [-m ‘log_message’ | -F file] [-r revision] [files…]
- •
- Requires: working directory, repository.
- •
- Changes: repository.
- •
- Synonym: ci
Use
commitwhen you want to incorporate changes from your working source files into the source repository.If you don’t specify particular files to commit, all of the files in your working current directory are examined.
commitis careful to change in the repository only those files that you have really changed. By default (or if you explicitly specify the-Roption), files in subdirectories are also examined and committed if they have changed; you can use the-loption to limitcommitto the current directory only.commitverifies that the selected files are up to date with the current revisions in the source repository; it will notify you, and exit without committing, if any of the specified files must be made current first withupdate(see node `update’ in the CVS manual).commitdoes not call theupdatecommand for you, but rather leaves that for you to do when the time is right.When all is well, an editor is invoked to allow you to enter a log message that will be written to one or more logging programs (see node `modules’ in the CVS manual, and see node `loginfo’ in the CVS manual) and placed in the
rcsfile inside the repository. This log message can be retrieved with thelogcommand; see node `log’ in the CVS manual. You can specify the log message on the command line with the-mmessage option, and thus avoid the editor invocation, or use the-Ffile option to specify that the argument file contains the log message.
commit options
These standard options are supported by commit (see node `Common options’ in the CVS manual for a complete description of them):
-
-l - Local; run only in current working directory.
-
-R - Commit directories recursively. This is on by default.
-
-rrevision - Commit to revision. revision must be either a branch, or a revision on the main trunk that is higher than any existing revision number (see node `Assigning revisions’ in the CVS manual). You cannot commit to a specific revision on a branch.
commitalso supports these options: -
-Ffile - Read the log message from file, instead of invoking an editor.
-
-f - Note that this is not the standard behavior of the
-foption as defined in `Common options’ in the CVS manual.Force
cvsto commit a new revision even if you haven’t made any changes to the file. If the current revision of file is 1.7, then the following two commands are equivalent: - $ cvs commit -f file
- $ cvs commit -r 1.8 file
-
The
-foption disables recursion (i.e., it implies-l). To forcecvsto commit a new revision for all files in all subdirectories, you must use-f -R. -
-mmessage - Use message as the log message, instead of invoking an editor.
commit examples
Committing to a branch
You can commit to a branch revision (one that has an even number of dots) with the -r option. To create a branch revision, use the -b option of the rtag or tag commands (see node `Branching and merging’ in the CVS manual). Then, either checkout or update can be used to base your sources on the newly created branch. From that point on, all commit changes made within these working sources will be automatically added to a branch revision, thereby not disturbing main-line development in any way. For example, if you had to create a patch to the 1.2 version of the product, even though the 2.0 version is already under development, you might do:
- $ cvs rtag -b -r FCS1_2 FCS1_2_Patch product_module
- $ cvs checkout -r FCS1_2_Patch product_module
- $ cd product_module
- [[ hack away ]]
- $ cvs commit
-
This works automatically since the
-roption is sticky.
Creating the branch after editing
Say you have been working on some extremely experimental software, based on whatever revision you happened to checkout last week. If others in your group would like to work on this software with you, but without disturbing main-line development, you could commit your change to a new branch. Others can then checkout your experimental stuff and utilize the full benefit of cvs conflict resolution. The scenario might look like:
- [[ hacked sources are present ]]
- $ cvs tag -b EXPR1
- $ cvs update -r EXPR1
- $ cvs commit
-
The
updatecommand will make the-r EXPR1option sticky on all files. Note that your changes to the files will never be removed by theupdatecommand. Thecommitwill automatically commit to the correct branch, because the-ris sticky. You could also do like this: - [[ hacked sources are present ]]
- $ cvs tag -b EXPR1
- $ cvs commit -r EXPR1
-
but then, only those files that were changed by you will have the
-r EXPR1sticky flag. If you hack away, and commit without specifying the-r EXPR1flag, some files may accidentally end up on the main trunk.To work with you on the experimental change, others would simply do
- $ cvs checkout -r EXPR1 whatever_module
diff
Show differences between revisions
- •
- Synopsis: diff [-lR] [-k kflag] [format_options] [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files…]
- •
- Requires: working directory, repository.
- •
- Changes: nothing.
The
diffcommand is used to compare different revisions of files. The default action is to compare your working files with the revisions they were based on, and report any differences that are found.If any file names are given, only those files are compared. If any directories are given, all files under them will be compared.
The exit status for diff is different than for other
cvscommands; for details see node `Exit status’ in the CVS manual.
diff options
These standard options are supported by diff (see node `Common options’ in the CVS manual for a complete description of them):
-
-Ddate - Use the most recent revision no later than date. See
-rfor how this affects the comparison. -
-kkflag - Process keywords according to kflag. See `Keyword substitution’ in the CVS manual.
-
-l - Local; run only in current working directory.
-
-R - Examine directories recursively. This option is on by default.
-
-rtag - Compare with revision tag. Zero, one or two
-roptions can be present. With no-roption, the working file will be compared with the revision it was based on. With one-r, that revision will be compared to your current working file. With two-roptions those two revisions will be compared (and your working file will not affect the outcome in any way).One or both
-roptions can be replaced by a-Ddate option, described above.The following options specify the format of the output. They have the same meaning as in GNU diff. Most options have two equivalent names, one of which is a single letter preceded by
–, and the other of which is a long name preceded by—. -
–lines - Show lines (an integer) lines of context. This option does not specify an output format by itself; it has no effect unless it is combined with
-cor-u. This option is obsolete. For proper operation,patchtypically needs at least two lines of context. -
-a - Treat all files as text and compare them line-by-line, even if they do not seem to be text.
-
-b - Ignore trailing white space and consider all other sequences of one or more white space characters to be equivalent.
-
-B - Ignore changes that just insert or delete blank lines.
-
–binary - Read and write data in binary mode.
-
–brief - Report only whether the files differ, not the details of the differences.
-
-c - Use the context output format.
-
-Clines -
–context[=lines] - Use the context output format, showing lines (an integer) lines of context, or three if lines is not given. For proper operation,
patchtypically needs at least two lines of context. -
–changed-group-format=format - Use format to output a line group containing differing lines from both files in if-then-else format. See `Line group formats’ in the CVS manual.
-
-d - Change the algorithm to perhaps find a smaller set of changes. This makes
diffslower (sometimes much slower). -
-e -
–ed - Make output that is a valid
edscript. -
–expand-tabs - Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
-
-f - Make output that looks vaguely like an
edscript but has changes in the order they appear in the file. -
-Fregexp - In context and unified format, for each hunk of differences, show some of the last preceding line that matches regexp.
-
–forward-ed - Make output that looks vaguely like an
edscript but has changes in the order they appear in the file. -
-H - Use heuristics to speed handling of large files that have numerous scattered small changes.
-
–horizon-lines=lines - Do not discard the last lines lines of the common prefix and the first lines lines of the common suffix.
-
-i - Ignore changes in case; consider upper- and lower-case letters equivalent.
-
-Iregexp - Ignore changes that just insert or delete lines that match regexp.
-
–ifdef=name - Make merged if-then-else output using name.
-
–ignore-all-space - Ignore white space when comparing lines.
-
–ignore-blank-lines - Ignore changes that just insert or delete blank lines.
-
–ignore-case - Ignore changes in case; consider upper- and lower-case to be the same.
-
–ignore-matching-lines=regexp - Ignore changes that just insert or delete lines that match regexp.
-
–ignore-space-change - Ignore trailing white space and consider all other sequences of one or more white space characters to be equivalent.
-
–initial-tab - Output a tab rather than a space before the text of a line in normal or context format. This causes the alignment of tabs in the line to look normal.
-
-Llabel - Use label instead of the file name in the context format and unified format headers.
-
–label=label - Use label instead of the file name in the context format and unified format headers.
-
–left-column - Print only the left column of two common lines in side by side format.
-
–line-format=format - Use format to output all input lines in if-then-else format. See `Line formats’ in the CVS manual.
-
–minimal - Change the algorithm to perhaps find a smaller set of changes. This makes
diffslower (sometimes much slower). -
-n - Output RCS-format diffs; like
-fexcept that each command specifies the number of lines affected. -
-N -
–new-file - In directory comparison, if a file is found in only one directory, treat it as present but empty in the other directory.
-
–new-group-format=format - Use format to output a group of lines taken from just the second file in if-then-else format. See `Line group formats’ in the CVS manual.
-
–new-line-format=format - Use format to output a line taken from just the second file in if-then-else format. See `Line formats’ in the CVS manual.
-
–old-group-format=format - Use format to output a group of lines taken from just the first file in if-then-else format. See `Line group formats’ in the CVS manual.
-
–old-line-format=format - Use format to output a line taken from just the first file in if-then-else format. See `Line formats’ in the CVS manual.
-
-p - Show which C function each change is in.
-
–rcs - Output RCS-format diffs; like
-fexcept that each command specifies the number of lines affected. -
–report-identical-files -
-s - Report when two files are the same.
-
–show-c-function - Show which C function each change is in.
-
–show-function-line=regexp - In context and unified format, for each hunk of differences, show some of the last preceding line that matches regexp.
-
–side-by-side - Use the side by side output format.
-
–speed-large-files - Use heuristics to speed handling of large files that have numerous scattered small changes.
-
–suppress-common-lines - Do not print common lines in side by side format.
-
-t - Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
-
-T - Output a tab rather than a space before the text of a line in normal or context format. This causes the alignment of tabs in the line to look normal.
-
–text - Treat all files as text and compare them line-by-line, even if they do not appear to be text.
-
-u - Use the unified output format.
-
–unchanged-group-format=format - Use format to output a group of common lines taken from both files in if-then-else format. see node `Line group formats’ in the CVS manual.
-
–unchanged-line-format=format - Use format to output a line common to both files in if-then-else format. see node `Line formats’ in the CVS manual.
-
-Ulines -
–unified[=lines] - Use the unified output format, showing lines (an integer) lines of context, or three if lines is not given. For proper operation,
patchtypically needs at least two lines of context. -
-w - Ignore white space when comparing lines.
-
-Wcolumns -
–width=columns - Use an output width of columns in side by side format.
-
-y - Use the side by side output format.
Line group formats
Line group formats let you specify formats suitable for many applications that allow if-then-else input, including programming languages and text formatting languages. A line group format specifies the output format for a contiguous group of similar lines.
For example, the following command compares the TeX file myfile with the original version from the repository, and outputs a merged file in which old regions are surrounded by egin{em}–nd{em} lines, and new regions are surrounded by egin{bf}–nd{bf} lines.
- cvs diff \
- –old-group-format=’egin{em}
- %<nd{em}
- ‘ \
- –new-group-format=’egin{bf}
- %>nd{bf}
- ‘ \
- myfile
-
The following command is equivalent to the above example, but it is a little more verbose, because it spells out the default line group formats.
- cvs diff \
- –old-group-format=’egin{em}
- %<nd{em}
- ‘ \
- –new-group-format=’egin{bf}
- %>nd{bf}
- ‘ \
-
–unchanged-group-format=’%=’
\ - –changed-group-format=’egin{em}
- %<nd{em}
- egin{bf}
- %>nd{bf}
- ‘ \
- myfile
Here is a more advanced example, which outputs a diff listing with headers containing line numbers in a “plain English” style.
- cvs diff \
- –unchanged-group-format=”
\ - –old-group-format=’——–
%dn line%(n=1?:s) deleted at %df: - %<‘ \
- –new-group-format=’——–
%dN line%(N=1?:s) added after %de: - %>’ \
- –changed-group-format=’——–
%dn line%(n=1?:s) changed at %df: - %<——– to:
- %>’ \
- myfile
To specify a line group format, use one of the options listed below. You can specify up to four line group formats, one for each kind of line group. You should quote format, because it typically contains shell metacharacters.
–old-group-format=format- These line groups are hunks containing only lines from the first file. The default old group format is the same as the changed group format if it is specified; otherwise it is a format that outputs the line group as-is.
–new-group-format=format- These line groups are hunks containing only lines from the second file. The default new group format is same as the changed group format if it is specified; otherwise it is a format that outputs the line group as-is.
–changed-group-format=format- These line groups are hunks containing lines from both files. The default changed group format is the concatenation of the old and new group formats.
–unchanged-group-format=format- These line groups contain lines common to both files. The default unchanged group format is a format that outputs the line group as-is.
In a line group format, ordinary characters represent themselves; conversion specifications start with
%and have one of the following forms.%<- stands for the lines from the first file, including the trailing newline. Each line is formatted according to the old line format (see node `Line formats’ in the CVS manual).
%>- stands for the lines from the second file, including the trailing newline. Each line is formatted according to the new line format.
%=- stands for the lines common to both files, including the trailing newline. Each line is formatted according to the unchanged line format.
%%- stands for
%.%c’C‘- where C is a single character, stands for C. C may not be a backslash or an apostrophe. For example,
%c’:’stands for a colon, even inside the then-part of an if-then-else format, which a colon would normally terminate.%c’\O‘- where O is a string of 1, 2, or 3 octal digits, stands for the character with octal code O. For example,
%c’
