[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 section B. Quick reference to CVS commands).
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The overall format of all CVS commands is:
cvs [ cvs_options ] cvs_command [ command_options ] [ command_args ] |
cvs
cvs_options
cvs_command
command_options
command_args
There is unfortunately some confusion between
cvs_options
and command_options
.
`-l', when given as a cvs_option
, only
affects some of the commands. When it is given as a
command_option
is has a different meaning, and
is accepted by more commands. In other words, do not
take the above categorization too seriously. Look at
the documentation instead.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 foo' would have the `-P' option added to the arguments, as well as `cvs co foo'.
With the example file above, the output from `cvs
diff foobar' will be in unidiff format. `cvs diff
-c foobar' will provide context diffs, as usual.
Getting "old" format diffs would be slightly more
complicated, because diff
doesn't have an option
to specify use of the "old" format, so you would need
`cvs -f diff foobar'.
In place of the command name you can use cvs
to
specify global options (see section A.4 Global options). For
example the following line in `.cvsrc'
cvs -z6 |
causes CVS to use compression level 6.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The available `cvs_options' (that are given to the left of `cvs_command') are:
--allow-root=rootdir
-a
-b bindir
-T tempdir
$TMPDIR
environment
variable and any precompiled directory. This parameter should be
specified as an absolute pathname.
(When running client/server, `-T' affects only the local process;
specifying `-T' for the client has no effect on the server and
vice versa.)
-d cvs_root_directory
$CVSROOT
environment variable. See section 2. The Repository.
-e editor
$CVSEDITOR
and $EDITOR
environment variables. For more information, see
1.3.2 Committing your changes.
-f
-H
--help
-l
-n
Note that CVS will not necessarily produce exactly the same output as without `-n'. In some cases the output will be the same, but in other cases CVS will skip some of the processing that would have been required to produce the exact same output.
-Q
-q
-r
$CVSREAD
environment variable is set
(see section D. All environment variables which affect CVS). The default is to
make working files writable, unless watches are on
(see section 10.6 Mechanisms to track who is editing files).
-s variable=value
-t
-v
--version
-w
$CVSREAD
environment variable.
Files are created read-write by default, unless $CVSREAD
is
set or `-r' is given.
-x
-z gzip-level
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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).
Warning: the `history' command is an exception; it supports many options that conflict even with these standard options.
-D date_spec
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', CVS records 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 section 4.9 Sticky tags).
`-D' is available with the annotate
, checkout
,
diff
, export
, history
,
rdiff
, rtag
, and update
commands.
(The history
command uses this option in a
slightly different way; see section A.11.1 history options).
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 CVS accepts 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, CVS also 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, CVS currently accepts a wide variety of other date formats. They are intentionally not documented here in any detail, and future versions of CVS might 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/96' is January 4,
not April 1.
Remember to quote the argument to the `-D' flag so that your shell doesn't interpret spaces as argument separators. A command using the `-D' flag can look like this:
$ cvs diff -D "1 hour ago" cvs.texinfo |
-f
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 that CVS will continue to give an error if you mistype a tag name.
`-f' is available with these commands:
annotate
, checkout
, export
,
rdiff
, rtag
, and update
.
Warning: The commit
and remove
commands also have a
`-f' option, but it has a different behavior for
those commands. See A.8.1 commit options, and
7.2 Removing files.
-k kflag
checkout
or update
commands,
CVS associates your selected kflag with the
file, and continues to use it with future update
commands on the same file until you specify otherwise.
The `-k' option is available with the add
,
checkout
, diff
, import
and
update
commands.
-l
Warning: this is not the same as the overall `cvs -l' option, which you can specify to the left of a cvs command!
Available with the following commands: annotate
, checkout
,
commit
, diff
, edit
, editors
, export
,
log
, rdiff
, remove
, rtag
,
status
, tag
, unedit
, update
, watch
,
and watchers
.
-m message
Available with the following commands: add
,
commit
and import
.
-n
Warning: this is not the same as the overall `cvs -n' option, which you can specify to the left of a cvs command!
Available with the checkout
, commit
, export
,
and rtag
commands.
-P
-p
checkout
and update
commands.
-R
Available with the following commands: annotate
, checkout
,
commit
, diff
, edit
, editors
, export
,
rdiff
, remove
, rtag
,
status
, tag
, unedit
, update
, watch
,
and watchers
.
-r tag
tag
or rtag
command, two special tags are
always available: `HEAD' refers to the most recent version
available in the repository, and `BASE' refers to the
revision you last checked out into the current working directory.
The tag specification is sticky when you use this
with checkout
or update
to make your own
copy of a file: CVS remembers the tag and continues to use it on
future update commands, until you specify otherwise (for more information
on sticky tags/dates, see section 4.9 Sticky tags).
The tag can be either a symbolic or numeric tag, as described in 4.4 Tags--Symbolic revisions, or the name of a branch, as described in 5. Branching and merging.
Specifying the `-q' global option along with the `-r' command option is often useful, to suppress the warning messages when the RCS file does not contain the specified tag.
Warning: this is not the same as the overall `cvs -r' option, which you can specify to the left of a CVS command!
`-r' is available with the checkout
, commit
,
diff
, history
, export
, rdiff
,
rtag
, and update
commands.
-W
import
,
and update
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This is the CVS interface to assorted administrative facilities. Some of them have questionable usefulness for CVS but 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 run cvs admin
(except for the cvs admin -k
command, which can
be run by anybody). This group should exist on the
server, or any system running the non-client/server
CVS. To disallow cvs admin
for all users,
create a group with no users in it. On NT, the
cvsadmin
feature does not exist and all users
can run cvs admin
.
A.6.1 admin options |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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
-alogins
-b[rev]
cvs admin -b
: to revert to the vendor's
version when using vendor branches (see section 13.3 Reverting to the latest vendor release).
There can be no space between `-b' and its argument.
-cstring
-e[logins]
-I
-i
cvs add
command
(see section 7.1 Adding files to a directory).
-ksubst
cvs update
, cvs export
, or cvs
checkout
overrides this default.
-l[rev]
This can be used in conjunction with the `rcslock.pl' script in the `contrib' directory of the CVS source 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 the `README' file 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
-mrev:msg
-Nname[:[rev]]
-nname[:[rev]]
-orange
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 CVS bug, 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
::rev
rev::
rev
rev1:rev2
:rev
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,
then CVS will 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 with cvs tag -d
, then run
cvs admin -o
. If one specifies the
non-`::' syntaxes, then CVS will delete the
revisions but leave the symbolic names pointing to
nonexistent revisions. This behavior is preserved for
compatibility with previous versions of CVS, but
because it isn't very useful, in the future it may
change to be like the `::' case.
Due to the way CVS handles branches rev cannot be specified symbolically if it is a branch. See section 5.5 Magic branch numbers, 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 section 5.8 Merging differences between any two revisions).
-q
-sstate[:rev]
dead
state for its own purposes; to
take a file to or from the dead
state use
commands like cvs remove
and cvs add
, not
cvs admin -s
.
-t[file]
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
-U
-u[rev]
commit
notification (see section 10.6.2 Telling CVS to notify you).
There can be no space between `-u' and its argument.
-Vn
-xsuffixes
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Create or update a working directory containing copies of the
source files specified by modules. You must execute
checkout
before using most of the other CVS
commands, 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 `modules' file. See section C.1 The modules file.
Depending on the modules you specify, checkout
may
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 checkout
is used to create
directories. The top-level directory created is always
added to the directory where checkout
is
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 that
checkout
will show the relative path leading to
each file as it is extracted into your private work
area (unless you specify the `-Q' global option).
The files created by checkout
are created
read-write, unless the `-r' option to CVS
(see section A.4 Global options) is specified, the
CVSREAD
environment variable is specified
(see section D. All environment variables which affect CVS), or a watch is in
effect for that file (see section 10.6 Mechanisms to track who is editing files).
Note that running checkout
on a directory that was already
built by a prior checkout
is also permitted.
This is similar to specifying the `-d' option
to the update
command in the sense that new
directories that have been created in the repository
will appear in your work area.
However, checkout
takes a module name whereas
update
takes a directory name. Also
to use checkout
this way it must be run from the
top level directory (where you originally ran
checkout
from), so before you run
checkout
to update an existing directory, don't
forget to change your directory to the top level
directory.
For the output produced by the checkout
command
see A.16.2 update output.
A.7.1 checkout options | ||
A.7.2 checkout examples |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These standard options are supported by checkout
(see section A.5 Common command options, for a complete description of
them):
-D date
-f
-k kflag
status
command can be viewed
to see the sticky options. See B. Quick reference to CVS commands, for
more information on the status
command.
-l
-n
-P
-p
-R
-r tag
In addition to those, you can use these special command
options with checkout
:
-A
-c
-d dir
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, CVS tries to "shorten" pathnames to avoid those empty directories.
For example, given a module `foo' that contains the file `bar.c', the command `cvs co -d dir foo' will create directory `dir' and place `bar.c' inside. Similarly, given a module `bar' which has subdirectory `baz' wherein there is a file `quux.c', the command `cvs co -d dir bar/baz' will create directory `dir' and place `quux.c' inside.
Using the `-N' flag will defeat this behavior. Given the same module definitions above, `cvs co -N -d dir foo' will create directories `dir/foo' and place `bar.c' inside, while `cvs co -N -d dir bar/baz' will create directories `dir/bar/baz' and place `quux.c' inside.
-j tag
With one `-j' option, merge changes from the ancestor revision to the revision specified with the `-j' option, 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 `-j' option.
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 section 5. Branching and merging.
-N
-s
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Get a copy of the module `tc':
$ cvs checkout tc |
Get a copy of the module `tc' as it looked one day ago:
$ cvs checkout -D yesterday tc |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Use commit
when 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. commit
is careful to change in the
repository only those files that you have really
changed. By default (or if you explicitly specify the
`-R' option), files in subdirectories are also
examined and committed if they have changed; you can
use the `-l' option to limit commit
to the
current directory only.
commit
verifies 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 with update
(see section A.16 update--Bring work tree in sync with repository).
commit
does not call the update
command
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 section C.1 The modules file, and see section C.3.5 Loginfo)
and placed in the RCS file inside the
repository. This log message can be retrieved with the
log
command; see A.13 log--Print out log information for files. You can specify the
log message on the command line with the `-m
message' option, and thus avoid the editor invocation,
or use the `-F file' option to specify
that the argument file contains the log message.
A.8.1 commit options | ||
A.8.2 commit examples |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These standard options are supported by commit
(see section A.5 Common command options, for a complete description of
them):
-l
-n
-R
-r revision
commit
also supports these options:
-F file
-f
Force CVS to 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 `-f' option disables recursion (i.e., it implies `-l'). To force CVS to commit a new revision for all files in all subdirectories, you must use `-f -R'.
-m message
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 section 5. Branching and merging). 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 `-r' option is sticky.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 update
command will make the `-r
EXPR1' option sticky on all files. Note that your
changes to the files will never be removed by the
update
command. The commit
will
automatically commit to the correct branch, because the
`-r' is 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 EXPR1' sticky flag. If you hack away, and commit without specifying the `-r EXPR1' flag, 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 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The diff
command 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 CVS commands; for details A.2 CVS's exit status.
A.9.1 diff options | ||
A.9.2 diff examples |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These standard options are supported by diff
(see section A.5 Common command options, for a complete description of
them):
-D date
-k kflag
-l
-R
-r tag
One or both `-r' options can be replaced by a `-D date' 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 `--'.
patch
typically needs at least two lines of context.
patch
typically needs at least two lines of
context.
diff
slower (sometimes much slower).
ed
script.
ed
script but has changes
in the order they appear in the file.
ed
script but has changes
in the order they appear in the file.
diff
slower (sometimes much slower).
patch
typically needs at least two lines of
context.
A.9.1.1 Line group formats | ||
A.9.1.2 Line formats |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 `\begin{em}'-`\end{em}' lines, and new regions are surrounded by `\begin{bf}'-`\end{bf}' lines.
cvs diff \ --old-group-format='\begin{em} %<\end{em} ' \ --new-group-format='\begin{bf} %>\end{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='\begin{em} %<\end{em} ' \ --new-group-format='\begin{bf} %>\end{bf} ' \ --unchanged-group-format='%=' \ --changed-group-format='\begin{em} %<\end{em} \begin{bf} %>\end{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.
In a line group format, ordinary characters represent themselves; conversion specifications start with `%' and have one of the following forms.
printf
conversion specification and n is one
of the following letters, stands for n's value formatted with F.
The printf
conversion specification can be `%d',
`%o', `%x', or `%X', specifying decimal, octal,
lower case hexadecimal, or upper case hexadecimal output
respectively. After the `%' the following options can appear in
sequence: a `-' specifying left-justification; an integer
specifying the minimum field width; and a period followed by an
optional integer specifying the minimum number of digits.
For example, `%5dN' prints the number of new lines in the group
in a field of width 5 characters, using the printf
format "%5d"
.
For example, `%(N=0?no:%dN) line%(N=1?:s)' is equivalent to `no lines' if N (the number of lines in the group in the the new file) is 0, to `1 line' if N is 1, and to `%dN lines' otherwise.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Line formats control how each line taken from an input file is output as part of a line group in if-then-else format.
For example, the following command outputs text with a one-column change indicator to the left of the text. The first column of output is `-' for deleted lines, `|' for added lines, and a space for unchanged lines. The formats contain newline characters where newlines are desired on output.
cvs diff \ --old-line-format='-%l ' \ --new-line-format='|%l ' \ --unchanged-line-format=' %l ' \ myfile |
To specify a line format, use one of the following options. You should quote format, since it often contains shell metacharacters.
In a line format, ordinary characters represent themselves; conversion specifications start with `%' and have one of the following forms.
printf
conversion specification,
stands for the line number formatted with F.
For example, `%.5dn' prints the line number using the
printf
format "%.5d"
. See section A.9.1.1 Line group formats, for
more about printf conversion specifications.
The default line format is `%l' followed by a newline character.
If the input contains tab characters and it is important that they line up on output, you should ensure that `%l' or `%L' in a line format is just after a tab stop (e.g. by preceding `%l' or `%L' with a tab character), or you should use the `-t' or `--expand-tabs' option.
Taken together, the line and line group formats let you specify many
different formats. For example, the following command uses a format
similar to diff
's normal format. You can tailor this command
to get fine control over diff
's output.
cvs diff \ --old-line-format='< %l ' \ --new-line-format='> %l ' \ --old-group-format='%df%(f=l?:,%dl)d%dE %<' \ --new-group-format='%dea%dF%(F=L?:,%dL) %>' \ --changed-group-format='%df%(f=l?:,%dl)c%dF%(F=L?:,%dL) %<--- %>' \ --unchanged-group-format='' \ myfile |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following line produces a Unidiff (`-u' flag) between revision 1.14 and 1.19 of `backend.c'. Due to the `-kk' flag no keywords are substituted, so differences that only depend on keyword substitution are ignored.
$ cvs diff -kk -u -r 1.14 -r 1.19 backend.c |
Suppose the experimental branch EXPR1 was based on a set of files tagged RELEASE_1_0. To see what has happened on that branch, the following can be used:
$ cvs diff -r RELEASE_1_0 -r EXPR1 |
A command like this can be used to produce a context diff between two releases:
$ cvs diff -c -r RELEASE_1_0 -r RELEASE_1_1 > diffs |
If you are maintaining ChangeLogs, a command like the following just before you commit your changes may help you write the ChangeLog entry. All local modifications that have not yet been committed will be printed.
$ cvs diff -u | less |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This command is a variant of checkout
; use it
when you want a copy of the source for module without
the CVS administrative directories. For example, you
might use export
to prepare source for shipment
off-site. This command requires that you specify a
date or tag (with `-D' or `-r'), so that you
can count on reproducing the source you ship to others
(and thus it always prunes empty directories).
One often would like to use `-kv' with cvs
export
. This causes any keywords to be
expanded such that an import done at some other site
will not lose the keyword revision information. But be
aware that doesn't handle an export containing binary
files correctly. Also be aware that after having used
`-kv', one can no longer use the ident
command (which is part of the RCS suite--see
ident(1)) which looks for keyword strings. If
you want to be able to use ident
you must not
use `-kv'.
A.10.1 export options |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These standard options are supported by export
(see section A.5 Common command options, for a complete description of
them):
-D date
-f
-l
-n
-R
-r tag
In addition, these options (that are common to
checkout
and export
) are also supported:
-d dir
-k subst
-N
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
CVS can keep a history file that tracks each use of the
checkout
, commit
, rtag
,
update
, and release
commands. You can
use history
to display this information in
various formats.
Logging must be enabled by creating the file `$CVSROOT/CVSROOT/history'.
Warning: history
uses `-f', `-l',
`-n', and `-p' in ways that conflict with the
normal use inside CVS (see section A.5 Common command options).
A.11.1 history options |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Several options (shown above as `-report') control what kind of report is generated:
-c
-e
-m module
-o
-T
-x type
Certain commands have a single record type:
F
O
E
T
One of four record types may result from an update:
C
G
U
W
One of three record types results from commit:
A
M
R
The options shown as `-flags' constrain or expand the report without requiring option arguments:
-a
history
).
-l
-w
history
is
executing.
The options shown as `-options args' constrain the report based on an argument:
-b str
-D date
-f file
-n module
-p repository
-r rev
-t tag
-u name
-z timezone
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Use import
to incorporate an entire source
distribution from an outside source (e.g., a source
vendor) into your source repository directory. You can
use this command both for initial creation of a
repository, and for wholesale updates to the module
from the outside source. See section 13. Tracking third-party sources, for
a discussion on this subject.
The repository argument gives a directory name (or a path to a directory) under the CVS root directory for repositories; if the directory did not exist, import creates it.
When you use import for updates to source that has been modified in your source repository (since a prior import), it will notify you of any files that conflict in the two branches of development; use `checkout -j' to reconcile the differences, as import instructs you to do.
If CVS decides a file should be ignored (see section C.5 Ignoring files via cvsignore), it does not import it and prints `I ' followed by the filename (see section A.12.2 import output, for a complete description of the output).
If the file `$CVSROOT/CVSROOT/cvswrappers' exists, any file whose names match the specifications in that file will be treated as packages and the appropriate filtering will be performed on the file/directory before being imported. See section C.2 The cvswrappers file.
The outside source is saved in a first-level branch, by default 1.1.1. Updates are leaves of this branch; for example, files from the first imported collection of source will be revision 1.1.1.1, then files from the first imported update will be revision 1.1.1.2, and so on.
At least three arguments are required.
repository is needed to identify the collection
of source. vendortag is a tag for the entire
branch (e.g., for 1.1.1). You must also specify at
least one releasetag to identify the files at
the leaves created each time you execute import
.
Note that import
does not change the
directory in which you invoke it. In particular, it
does not set up that directory as a CVS working
directory; if you want to work with the sources import
them first and then check them out into a different
directory (see section 1.3.1 Getting the source).
A.12.1 import options | ||
A.12.2 import output | ||
A.12.3 import examples |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This standard option is supported by import
(see section A.5 Common command options, for a complete description):
-m message
There are the following additional special options.
-b branch
-k subst
-I name
name can be a file name pattern of the same type that you can specify in the `.cvsignore' file. See section C.5 Ignoring files via cvsignore.
-W spec
spec can be a file name pattern of the same type that you can specify in the `.cvswrappers' file. See section C.2 The cvswrappers file.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
import
keeps you informed of its progress by printing a line
for each file, preceded by one character indicating the status of the file:
U file
N file
C file
I file
L file
cvs import
ignores symbolic links.
People periodically suggest that this behavior should
be changed, but if there is a consensus on what it
should be changed to, it doesn't seem to be apparent.
(Various options in the `modules' file can be used
to recreate symbolic links on checkout, update, etc.;
see section C.1 The modules file.)
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
See 13. Tracking third-party sources, and 3.1.1 Creating a directory tree from a number of files.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Display log information for files. log
used to
call the RCS utility rlog
. Although this
is no longer true in the current sources, this history
determines the format of the output and the options,
which are not quite in the style of the other CVS
commands.
The output includes the location of the RCS file, the head revision (the latest revision on the trunk), all symbolic names (tags) and some other things. For each revision, the revision number, the author, the number of lines added/deleted and the log message are printed. All times are displayed in Coordinated Universal Time (UTC). (Other parts of CVS print times in the local timezone).
Warning: log
uses `-R' in a way that conflicts
with the normal use inside CVS (see section A.5 Common command options).
A.13.1 log options | ||
A.13.2 log examples |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
By default, log
prints all information that is
available. All other options restrict the output.
-b
-d dates
d1<d2
d2>d1
<d
d>
d<
>d
d
The `>' or `<' characters may be followed by `=' to indicate an inclusive range rather than an exclusive one.
Note that the separator is a semicolon (;).
-h
-l
-N
-R
-rrevisions
rev1:rev2
rev1::rev2
:rev
::rev
rev:
rev::
branch
branch1:branch2
branch1::branch2
branch.
A bare `-r' with no revisions means the latest revision on the default branch, normally the trunk. There can be no space between the `-r' option and its argument.
-S
-s states
-t
-wlogins
log
prints the intersection of the revisions
selected with the options `-d', `-s', and
`-w', intersected with the union of the revisions
selected by `-b' and `-r'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Contributed examples are gratefully accepted.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Builds a Larry Wall format patch(1) file between two
releases, that can be fed directly into the patch
program to bring an old release up-to-date with the new
release. (This is one of the few CVS commands that
operates directly from the repository, and doesn't
require a prior checkout.) The diff output is sent to
the standard output device.
You can specify (using the standard `-r' and `-D' options) any combination of one or two revisions or dates. If only one revision or date is specified, the patch file reflects differences between that revision or date and the current head revisions in the RCS file.
Note that if the software release affected is contained
in more than one directory, then it may be necessary to
specify the `-p' option to the patch
command when
patching the old sources, so that patch
is able to find
the files that are located in other directories.
A.14.1 rdiff options | ||
A.14.2 rdiff examples |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These standard options are supported by rdiff
(see section A.5 Common command options, for a complete description of
them):
-D date
-f
-l
-R
-r tag
In addition to the above, these options are available:
-c
-s
-t
-u
patch
program can't handle the unidiff
format, so if you plan to post this patch to the net
you should probably not use `-u'.
-V vn
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Suppose you receive mail from [email protected] asking for an update from release 1.2 to 1.4 of the tc compiler. You have no such patches on hand, but with CVS that can easily be fixed with a command such as this:
$ cvs rdiff -c -r FOO1_2 -r FOO1_4 tc | \ $$ Mail -s 'The patches you asked for' [email protected] |
Suppose you have made release 1.3, and forked a branch called `R_1_3fix' for bugfixes. `R_1_3_1' corresponds to release 1.3.1, which was made some time ago. Now, you want to see how much development has been done on the branch. This command can be used:
$ cvs patch -s -r R_1_3_1 -r R_1_3fix module-name cvs rdiff: Diffing module-name File ChangeLog,v changed from revision 1.52.2.5 to 1.52.2.6 File foo.c,v changed from revision 1.52.2.3 to 1.52.2.4 File bar.h,v changed from revision 1.29.2.1 to 1.2 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This command is meant to safely cancel the effect of `cvs checkout'. Since CVS doesn't lock files, it isn't strictly necessary to use this command. You can always simply delete your working directory, if you like; but you risk losing changes you may have forgotten, and you leave no trace in the CVS history file (see section C.7 The history file) that you've abandoned your checkout.
Use `cvs release' to avoid these problems. This command checks that no uncommitted changes are present; that you are executing it from immediately above a CVS working directory; and that the repository recorded for your files is the same as the repository defined in the module database.
If all these conditions are true, `cvs release' leaves a record of its execution (attesting to your intentionally abandoning your checkout) in the CVS history log.
A.15.1 release options | ||
A.15.2 release output | ||
A.15.3 release examples |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The release
command supports one command option:
-d
Warning: The release
command deletes
all directories and files recursively. This
has the very serious side-effect that any directory
that you have created inside your checked-out sources,
and not added to the repository (using the add
command; see section 7.1 Adding files to a directory) will be silently deleted--even
if it is non-empty!
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Before release
releases your sources it will
print a one-line message for any file that is not
up-to-date.
Warning: Any new directories that you have
created, but not added to the CVS directory hierarchy
with the add
command (see section 7.1 Adding files to a directory) will be
silently ignored (and deleted, if `-d' is
specified), even if they contain files.
U file
P file
A file
R file
M file
? file
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Release the `tc' directory, and delete your local working copy of the files.
$ cd .. # You must stand immediately above the # sources when you issue `cvs release'. $ cvs release -d tc You have [0] altered files in this repository. Are you sure you want to release (and delete) directory `tc': y $ |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
After you've run checkout to create your private copy
of source from the common repository, other developers
will continue changing the central source. From time
to time, when it is convenient in your development
process, you can use the update
command from
within your working directory to reconcile your work
with any revisions applied to the source repository
since your last checkout or update.
A.16.1 update options | ||
A.16.2 update output |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
These standard options are available with update
(see section A.5 Common command options, for a complete description of
them):
-D date
-f
-k kflag
status
command can be viewed
to see the sticky options. See B. Quick reference to CVS commands, for
more information on the status
command.
-l
-P
-p
-R
-r rev
These special options are also available with
update
.
-A
-C
-d
update
acts only on directories and files that
were already enrolled in your working directory.
This is useful for updating directories that were created in the repository since the initial checkout; but it has an unfortunate side effect. If you deliberately avoided certain directories in the repository when you created your working directory (either through use of a module name or by listing explicitly the files and directories you wanted on the command line), then updating with `-d' will create those directories, which may not be what you want.
-I name
-Wspec
spec can be a file name pattern of the same type that you can specify in the `.cvswrappers' file. See section C.2 The cvswrappers file.
-jrevision
With one `-j' option, merge changes from the ancestor revision to the revision specified with the `-j' option, 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 `-j' option.
Note that using a single `-j tagname' option rather than `-j branchname' to merge changes from a branch will often not remove files which were removed on the branch. See section 5.9 Merging can add or remove files, for more.
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 section 5. Branching and merging.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
update
and checkout
keep you informed of
their progress by printing a line for each file, preceded
by one character indicating the status of the file:
U file
P file
A file
commit
on the file. This is a
reminder to you that the file needs to be committed.
R file
commit
on the file. This is a
reminder to you that the file needs to be committed.
M file
`M' can indicate one of two states for a file you're working on: either there were no modifications to the same file in the repository, so that your file remains as you last saw it; or there were modifications in the repository as well as in your copy, but they were merged successfully, without conflict, in your working directory.
CVS will print some messages if it merges your work,
and a backup copy of your working file (as it looked
before you ran update
) will be made. The exact
name of that file is printed while update
runs.
C file
? file
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |