home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Geek Gadgets 1
/
ADE-1.bin
/
ade-bin
/
info
/
cvs.info-3
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
Macintosh to JP
NeXTSTEP
RISC OS/Acorn
Shift JIS
UTF-8
Wrap
GNU Info File
|
1996-10-13
|
43.1 KB
|
1,148 lines
This is Info file cvs.info, produced by Makeinfo-1.64 from the input
file /ade-source/fsf/cvs/doc/cvs.texinfo.
Copyright (C) 1992, 1993 Signum Support AB Copyright (C) 1993, 1994
Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.
Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the section entitled "GNU General Public License" is included
exactly as in the original, and provided that the entire resulting
derived work is distributed under the terms of a permission notice
identical to this one.
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the section entitled "GNU General Public License"
and this permission notice may be included in translations approved by
the Free Software Foundation instead of in the original English.
File: cvs.info, Node: Recursive behavior, Next: Adding files, Prev: Merging, Up: Top
Recursive behavior
******************
Almost all of the subcommands of CVS work recursively when you
specify a directory as an argument. For instance, consider this
directory structure:
`$HOME'
|
+--tc
| |
+--CVS
| (internal CVS files)
+--Makefile
+--backend.c
+--driver.c
+--frontend.c
+--parser.c
+--man
| |
| +--CVS
| | (internal CVS files)
| +--tc.1
|
+--testing
|
+--CVS
| (internal CVS files)
+--testpgm.t
+--test2.t
If `tc' is the current working directory, the following is true:
* `cvs update testing' is equivalent to `cvs update
testing/testpgm.t testing/test2.t'
* `cvs update testing man' updates all files in the subdirectories
* `cvs update .' or just `cvs update' updates all files in the `tc'
module
If no arguments are given to `update' it will update all files in
the current working directory and all its subdirectories. In other
words, `.' is a default argument to `update'. This is also true for
most of the CVS subcommands, not only the `update' command.
The recursive behavior of the CVS subcommands can be turned off with
the `-l' option.
$ cvs update -l # Don't update files in subdirectories
File: cvs.info, Node: Adding files, Next: Removing files, Prev: Recursive behavior, Up: Top
Adding files to a directory
***************************
To add a new file to a directory, follow these steps.
* You must have a working copy of the directory. *Note Getting the
source::.
* Create the new file inside your working copy of the directory.
* Use `cvs add FILENAME' to tell CVS that you want to version
control the file. If the file contains binary data, specify `-kb'
(*note Binary files::.).
* Use `cvs commit FILENAME' to actually check in the file into the
repository. Other developers cannot see the file until you
perform this step.
You can also use the `add' command to add a new directory.
Unlike most other commands, the `add' command is not recursive. You
cannot even type `cvs add foo/bar'! Instead, you have to
$ cd foo
$ cvs add bar
- Command: cvs add [`-k' KFLAG] [`-m' MESSAGE] FILES ...
Schedule FILES to be added to the repository. The files or
directories specified with `add' must already exist in the current
directory. To add a whole new directory hierarchy to the source
repository (for example, files received from a third-party
vendor), use the `import' command instead. *Note import::.
The added files are not placed in the source repository until you
use `commit' to make the change permanent. Doing an `add' on a
file that was removed with the `remove' command will undo the
effect of the `remove', unless a `commit' command intervened.
*Note Removing files::, for an example.
The `-k' option specifies the default way that this file will be
checked out; for more information see *Note Substitution modes::.
The `-m' option specifies a description for the file. This
description appears in the history log (if it is enabled, *note
history file::.). It will also be saved in the version history
inside the repository when the file is committed. The `log'
command displays this description. The description can be changed
using `admin -t'. *Note admin::. If you omit the `-m
DESCRIPTION' flag, an empty string will be used. You will not be
prompted for a description.
For example, the following commands add the file `backend.c' to the
repository:
$ cvs add backend.c
$ cvs commit -m "Early version. Not yet compilable." backend.c
When you add a file it is added only on the branch which you are
working on (*note Branches::.). You can later merge the additions to
another branch if you want (*note Merging adds and removals::.).
File: cvs.info, Node: Removing files, Next: Tracking sources, Prev: Adding files, Up: Top
Removing files from a module
****************************
Modules change. New files are added, and old files disappear.
Still, you want to be able to retrieve an exact copy of old releases of
the module.
Here is what you can do to remove a file from a module, but remain
able to retrieve old revisions:
* Make sure that you have not made any uncommitted modifications to
the file. *Note Viewing differences::, for one way to do that.
You can also use the `status' or `update' command. If you remove
the file without committing your changes, you will of course not
be able to retrieve the file as it was immediately before you
deleted it.
* Remove the file from your working copy of the module. You can for
instance use `rm'.
* Use `cvs remove FILENAME' to tell CVS that you really want to
delete the file.
* Use `cvs commit FILENAME' to actually perform the removal of the
file from the repository.
When you commit the removal of the file, CVS records the fact that
the file no longer exists. It is possible for a file to exist on only
some branches and not on others, or to re-add another file with the same
name later. CVS will correctly create or not create the file, based on
the `-r' and `-D' options specified to `checkout' or `update'.
- Command: cvs remove [`-lR'] FILES ...
Schedule file(s) to be removed from the repository (files which
have not already been removed from the working directory are not
processed). This command does not actually remove the file from
the repository until you commit the removal. The `-R' option (the
default) specifies that it will recurse into subdirectories; `-l'
specifies that it will not.
Here is an example of removing several files:
$ cd test
$ rm ?.c
$ cvs remove
cvs remove: Removing .
cvs remove: scheduling a.c for removal
cvs remove: scheduling b.c for removal
cvs remove: use 'cvs commit' to remove these files permanently
$ cvs ci -m "Removed unneeded files"
cvs commit: Examining .
cvs commit: Committing .
If you change your mind you can easily resurrect the file before you
commit it, using the `add' command.
$ ls
CVS ja.h oj.c
$ rm oj.c
$ cvs remove oj.c
cvs remove: scheduling oj.c for removal
cvs remove: use 'cvs commit' to remove this file permanently
$ cvs add oj.c
U oj.c
cvs add: oj.c, version 1.1.1.1, resurrected
If you realize your mistake before you run the `remove' command you
can use `update' to resurrect the file:
$ rm oj.c
$ cvs update oj.c
cvs update: warning: oj.c was lost
U oj.c
When you remove a file it is added only on the branch which you are
working on (*note Branches::.). You can later merge the additions to
another branch if you want (*note Merging adds and removals::.).
File: cvs.info, Node: Tracking sources, Next: Moving files, Prev: Removing files, Up: Top
Tracking third-party sources
****************************
If you modify a program to better fit your site, you probably want
to include your modifications when the next release of the program
arrives. CVS can help you with this task.
In the terminology used in CVS, the supplier of the program is
called a "vendor". The unmodified distribution from the vendor is
checked in on its own branch, the "vendor branch". CVS reserves branch
1.1.1 for this use.
When you modify the source and commit it, your revision will end up
on the main trunk. When a new release is made by the vendor, you
commit it on the vendor branch and copy the modifications onto the main
trunk.
Use the `import' command to create and update the vendor branch.
After a successful `import' the vendor branch is made the `head'
revision, so anyone that checks out a copy of the file gets that
revision. When a local modification is committed it is placed on the
main trunk, and made the `head' revision.
* Menu:
* First import:: Importing a module for the first time
* Update imports:: Updating a module with the import command
* Binary files in imports:: Binary files require special handling
File: cvs.info, Node: First import, Next: Update imports, Up: Tracking sources
Importing a module for the first time
=====================================
Use the `import' command to check in the sources for the first time.
When you use the `import' command to track third-party sources, the
"vendor tag" and "release tags" are useful. The "vendor tag" is a
symbolic name for the branch (which is always 1.1.1, unless you use the
`-b BRANCH' flag--*Note import options::.). The "release tags" are
symbolic names for a particular release, such as `FSF_0_04'.
Suppose you use `wdiff' (a variant of `diff' that ignores changes
that only involve whitespace), and are going to make private
modifications that you want to be able to use even when new releases
are made in the future. You start by importing the source to your
repository:
$ tar xfz wdiff-0.04.tar.gz
$ cd wdiff-0.04
$ cvs import -m "Import of FSF v. 0.04" fsf/wdiff FSF_DIST WDIFF_0_04
The vendor tag is named `FSF_DIST' in the above example, and the
only release tag assigned is `WDIFF_0_04'.
File: cvs.info, Node: Update imports, Next: Binary files in imports, Prev: First import, Up: Tracking sources
Updating a module with the import command
=========================================
When a new release of the source arrives, you import it into the
repository with the same `import' command that you used to set up the
repository in the first place. The only difference is that you specify
a different release tag this time.
$ tar xfz wdiff-0.05.tar.gz
$ cd wdiff-0.05
$ cvs import -m "Import of FSF v. 0.05" fsf/wdiff FSF_DIST WDIFF_0_05
For files that have not been modified locally, the newly created
revision becomes the head revision. If you have made local changes,
`import' will warn you that you must merge the changes into the main
trunk, and tell you to use `checkout -j' to do so.
$ cvs checkout -jFSF_DIST:yesterday -jFSF_DIST wdiff
The above command will check out the latest revision of `wdiff',
merging the changes made on the vendor branch `FSF_DIST' since
yesterday into the working copy. If any conflicts arise during the
merge they should be resolved in the normal way (*note Conflicts
example::.). Then, the modified files may be committed.
Using a date, as suggested above, assumes that you do not import
more than one release of a product per day. If you do, you can always
use something like this instead:
$ cvs checkout -jWDIFF_0_04 -jWDIFF_0_05 wdiff
In this case, the two above commands are equivalent.
File: cvs.info, Node: Binary files in imports, Prev: Update imports, Up: Tracking sources
How to handle binary files with cvs import
==========================================
Use the `-k' wrapper option to tell import which files are binary.
*Note Wrappers::.
File: cvs.info, Node: Moving files, Next: Moving directories, Prev: Tracking sources, Up: Top
Moving and renaming files
*************************
Moving files to a different directory or renaming them is not
difficult, but some of the ways in which this works may be non-obvious.
(Moving or renaming a directory is even harder. *Note Moving
directories::.).
The examples below assume that the file OLD is renamed to NEW.
* Menu:
* Outside:: The normal way to Rename
* Inside:: A tricky, alternative way
* Rename by copying:: Another tricky, alternative way
File: cvs.info, Node: Outside, Next: Inside, Up: Moving files
The Normal way to Rename
========================
The normal way to move a file is to copy OLD to NEW, and then issue
the normal CVS commands to remove OLD from the repository, and add NEW
to it. (Both OLD and NEW could contain relative paths, for example
`foo/bar.c').
$ mv OLD NEW
$ cvs remove OLD
$ cvs add NEW
$ cvs commit -m "Renamed OLD to NEW" OLD NEW
This is the simplest way to move a file, it is not error-prone, and
it preserves the history of what was done. Note that to access the
history of the file you must specify the old or the new name, depending
on what portion of the history you are accessing. For example, `cvs
log OLD' will give the log up until the time of the rename.
When NEW is committed its revision numbers will start at 1.0 again,
so if that bothers you, use the `-r rev' option to commit (*note commit
options::.)
File: cvs.info, Node: Inside, Next: Rename by copying, Prev: Outside, Up: Moving files
Moving the history file
=======================
This method is more dangerous, since it involves moving files inside
the repository. Read this entire section before trying it out!
$ cd $CVSROOT/MODULE
$ mv OLD,v NEW,v
Advantages:
* The log of changes is maintained intact.
* The revision numbers are not affected.
Disadvantages:
* Old releases of the module cannot easily be fetched from the
repository. (The file will show up as NEW even in revisions from
the time before it was renamed).
* There is no log information of when the file was renamed.
* Nasty things might happen if someone accesses the history file
while you are moving it. Make sure no one else runs any of the CVS
commands while you move it.
File: cvs.info, Node: Rename by copying, Prev: Inside, Up: Moving files
Copying the history file
========================
This way also involves direct modifications to the repository. It
is safe, but not without drawbacks.
# Copy the RCS file inside the repository
$ cd $CVSROOT/MODULE
$ cp OLD,v NEW,v
# Remove the old file
$ cd ~/MODULE
$ rm OLD
$ cvs remove OLD
$ cvs commit OLD
# Remove all tags from NEW
$ cvs update NEW
$ cvs log NEW # Remember the non-branch tag names
$ cvs tag -d TAG1 NEW
$ cvs tag -d TAG2 NEW
...
By removing the tags you will be able to check out old revisions of
the module.
Advantages:
* Checking out old revisions works correctly, as long as you use
`-rTAG' and not `-DDATE' to retrieve the revisions.
* The log of changes is maintained intact.
* The revision numbers are not affected.
Disadvantages:
* You cannot easily see the history of the file across the rename.
* Unless you use the `-r rev' (*note commit options::.) flag when
NEW is committed its revision numbers will start at 1.0 again.
File: cvs.info, Node: Moving directories, Next: History browsing, Prev: Moving files, Up: Top
Moving and renaming directories
*******************************
If you want to be able to retrieve old versions of the module, you
must move each file in the directory with the CVS commands. *Note
Outside::. The old, empty directory will remain inside the repository,
but it will not appear in your workspace when you check out the module
in the future.
If you really want to rename or delete a directory, you can do it
like this:
1. Inform everyone who has a copy of the module that the directory
will be renamed. They should commit all their changes, and remove
their working copies of the module, before you take the steps
below.
2. Rename the directory inside the repository.
$ cd $CVSROOT/MODULE
$ mv OLD-DIR NEW-DIR
3. Fix the CVS administrative files, if necessary (for instance if
you renamed an entire module).
4. Tell everyone that they can check out the module and continue
working.
If someone had a working copy of the module the CVS commands will
cease to work for him, until he removes the directory that disappeared
inside the repository.
It is almost always better to move the files in the directory
instead of moving the directory. If you move the directory you are
unlikely to be able to retrieve old releases correctly, since they
probably depend on the name of the directories.
File: cvs.info, Node: History browsing, Next: Keyword substitution, Prev: Moving directories, Up: Top
History browsing
****************
Once you have used CVS to store a version control history--what
files have changed when, how, and by whom, there are a variety of
mechanisms for looking through the history.
* Menu:
* log messages:: Log messages
* history database:: The history database
* user-defined logging:: User-defined logging
* annotate:: What revision modified each line of a file?
File: cvs.info, Node: log messages, Next: history database, Up: History browsing
Log messages
============
Whenever you commit a file you specify a log message.
To look through the log messages which have been specified for every
revision which has been committed, use the `cvs log' command (*note
log::.).
File: cvs.info, Node: history database, Next: user-defined logging, Prev: log messages, Up: History browsing
The history database
====================
You can use the history file (*note history file::.) to log various
CVS actions. To retrieve the information from the history file, use
the `cvs history' command (*note history::.).
File: cvs.info, Node: user-defined logging, Next: annotate, Prev: history database, Up: History browsing
User-defined logging
====================
You can customize CVS to log various kinds of actions, in whatever
manner you choose. These mechanisms operate by executing a script at
various times. The script might append a message to a file listing the
information and the programmer who created it, or send mail to a group
of developers, or, perhaps, post a message to a particular newsgroup.
To log commits, use the `loginfo' file (*note loginfo::.). To log
commits, checkouts, exports, and tags, respectively, you can also use
the `-i', `-o', `-e', and `-t' options in the modules file. For a more
flexible way of giving notifications to various users, which requires
less in the way of keeping centralized scripts up to date, use the `cvs
watch add' command (*note Getting Notified::.); this command is useful
even if you are not using `cvs watch on'.
The `taginfo' file defines programs to execute when someone executes
a `tag' or `rtag' command. The `taginfo' file has the standard form
for administrative files (*note Administrative files::.), where each
line is a regular expression followed by a command to execute. The
arguments passed to the command are, in order, the TAGNAME, OPERATION
(`add' for `tag', `mov' for `tag -F', and `del' for `tag -d'),
REPOSITORY, and any remaining are pairs of FILENAME REVISION. A
non-zero exit of the filter program will cause the tag to be aborted.
File: cvs.info, Node: annotate, Prev: user-defined logging, Up: History browsing
Annotate command
================
- Command: cvs annotate [`-lf'] [`-r rev'|`-D date'] FILES ...
For each file in FILES, print the head revision of the trunk,
together with information on the last modification for each line.
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 `ssfile' currently contains two lines. The `ssfile line
1' line was checked in by `mary' on March 27. Then, on March 28,
`joe' added a line `ssfile line 2', without modifying the `ssfile
line 1' line. This report doesn't tell you anything about lines
which have been deleted or replaced; you need to use `cvs diff'
for that (*note diff::.).
These standard options are available with `annotate' (*note Common
options::., for a complete description of them):
`-D DATE'
Annotate the most recent revision no later than DATE.
`-f'
Only useful with the `-D DATE' or `-r TAG' flags. If no matching
revision is found, annotate the most recent revision (instead of
ignoring the file).
`-l'
Local; run only in current working directory. *Note Recursive
behavior::.
`-r TAG'
Annotate revision TAG.
File: cvs.info, Node: Keyword substitution, Next: Binary files, Prev: History browsing, Up: Top
Keyword substitution
********************
As long as you edit source files inside your working copy of a
module you can always find out the state of your files via `cvs status'
and `cvs log'. But as soon as you export the files from your
development environment it becomes harder to identify which revisions
they are.
RCS uses a mechanism known as "keyword substitution" (or "keyword
expansion") to help identifying the files. Embedded strings of the form
`$KEYWORD$' and `$KEYWORD:...$' in a file are replaced with strings of
the form `$KEYWORD:VALUE$' whenever you obtain a new revision of the
file.
* Menu:
* Keyword list:: RCS Keywords
* Using keywords:: Using keywords
* Avoiding substitution:: Avoiding substitution
* Substitution modes:: Substitution modes
* Log keyword:: Problems with the $Log$ keyword.
File: cvs.info, Node: Keyword list, Next: Using keywords, Up: Keyword substitution
RCS Keywords
============
This is a list of the keywords that RCS currently (in release
5.6.0.1) supports:
`$Author$'
The login name of the user who checked in the revision.
`$Date$'
The date and time (UTC) the revision was checked in.
`$Header$'
A standard header containing the full pathname of the RCS file,
the revision number, the date (UTC), the author, the state, and
the locker (if locked). Files will normally never be locked when
you use CVS.
`$Id$'
Same as `$Header$', except that the RCS filename is without a path.
`$Name$'
Tag name used to check out this file.
`$Locker$'
The login name of the user who locked the revision (empty if not
locked, and thus almost always useless when you are using CVS).
`$Log$'
The log message supplied during commit, preceded by a header
containing the RCS filename, the revision number, the author, and
the date (UTC). Existing log messages are *not* replaced.
Instead, the new log message is inserted after `$Log:...$'. Each
new line is prefixed with a "comment leader" which RCS guesses
from the file name extension. It can be changed with `cvs admin
-c'. *Note admin options::. This keyword is useful for
accumulating a complete change log in a source file, but for
several reasons it can be problematic. *Note Log keyword::.
`$RCSfile$'
The name of the RCS file without a path.
`$Revision$'
The revision number assigned to the revision.
`$Source$'
The full pathname of the RCS file.
`$State$'
The state assigned to the revision. States can be assigned with
`cvs admin -s'--*Note admin options::.
File: cvs.info, Node: Using keywords, Next: Avoiding substitution, Prev: Keyword list, Up: Keyword substitution
Using keywords
==============
To include a keyword string you simply include the relevant text
string, such as `$Id$', inside the file, and commit the file. CVS will
automatically expand the string as part of the commit operation.
It is common to embed `$Id$' string in the C source code. This
example shows the first few lines of a typical file, after keyword
substitution has been performed:
static char *rcsid="$Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
/* The following lines will prevent `gcc' version 2.X
from issuing an "unused variable" warning. */
#if __GNUC__ == 2
#define USE(var) static void * use_##var = (&use_##var, (void *) &var)
USE (rcsid);
#endif
Even though a clever optimizing compiler could remove the unused
variable `rcsid', most compilers tend to include the string in the
binary. Some compilers have a `#pragma' directive to include literal
text in the binary.
The `ident' command (which is part of the RCS package) can be used
to extract keywords and their values from a file. This can be handy
for text files, but it is even more useful for extracting keywords from
binary files.
$ ident samp.c
samp.c:
$Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
$ gcc samp.c
$ ident a.out
a.out:
$Id: samp.c,v 1.5 1993/10/19 14:57:32 ceder Exp $
SCCS is another popular revision control system. It has a command,
`what', which is very similar to `ident' and used for the same purpose.
Many sites without RCS have SCCS. Since `what' looks for the
character sequence `@(#)' it is easy to include keywords that are
detected by either command. Simply prefix the RCS keyword with the
magic SCCS phrase, like this:
static char *id="@(#) $Id: ab.c,v 1.5 1993/10/19 14:57:32 ceder Exp $";
File: cvs.info, Node: Avoiding substitution, Next: Substitution modes, Prev: Using keywords, Up: Keyword substitution
Avoiding substitution
=====================
Keyword substitution has its disadvantages. Sometimes you might
want the literal text string `$Author$' to appear inside a file without
RCS interpreting it as a keyword and expanding it into something like
`$Author: ceder $'.
There is unfortunately no way to selectively turn off keyword
substitution. You can use `-ko' (*note Substitution modes::.) to turn
off keyword substitution entirely.
In many cases you can avoid using RCS keywords in the source, even
though they appear in the final product. For example, the source for
this manual contains `$@asis{}Author$' whenever the text `$Author$'
should appear. In `nroff' and `troff' you can embed the null-character
`\&' inside the keyword for a similar effect.
File: cvs.info, Node: Substitution modes, Next: Log keyword, Prev: Avoiding substitution, Up: Keyword substitution
Substitution modes
==================
Each file has a stored default substitution mode, and each working
directory copy of a file also has a substitution mode. The former is
set by the `-k' option to `cvs add' and `cvs admin'; the latter is set
by the -k or -A options to `cvs checkout' or `cvs update'. `cvs diff'
also has a `-k' option. For some examples, *Note Binary files::.
The modes available are:
`-kkv'
Generate keyword strings using the default form, e.g. `$Revision:
5.7 $' for the `Revision' keyword.
`-kkvl'
Like `-kkv', except that a locker's name is always inserted if the
given revision is currently locked. This option is normally not
useful when CVS is used.
`-kk'
Generate only keyword names in keyword strings; omit their values.
For example, for the `Revision' keyword, generate the string
`$Revision$' instead of `$Revision: 5.7 $'. This option is useful
to ignore differences due to keyword substitution when comparing
different revisions of a file.
`-ko'
Generate the old keyword string, present in the working file just
before it was checked in. For example, for the `Revision'
keyword, generate the string `$Revision: 1.1 $' instead of
`$Revision: 5.7 $' if that is how the string appeared when the
file was checked in.
`-kb'
Like `-ko', but also inhibit conversion of line endings between
the canonical form in which they are stored in the repository
(linefeed only), and the form appropriate to the operating system
in use on the client. For systems, like unix, which use linefeed
only to terminate lines, this is the same as `-ko'. For more
information on binary files, see *Note Binary files::.
`-kv'
Generate only keyword values for keyword strings. For example,
for the `Revision' keyword, generate the string `5.7' instead of
`$Revision: 5.7 $'. This can help generate files in programming
languages where it is hard to strip keyword delimiters like
`$Revision: $' from a string. However, further keyword
substitution cannot be performed once the keyword names are
removed, so this option should be used with care.
One often would like to use `-kv' with `cvs export'--*note
export::.. But be aware that doesn't handle an export containing
binary files correctly.
File: cvs.info, Node: Log keyword, Prev: Substitution modes, Up: Keyword substitution
Problems with the $Log$ keyword.
================================
The `$Log$' keyword is somewhat controversial. As long as you are
working on your development system the information is easily accessible
even if you do not use the `$Log$' keyword--just do a `cvs log'. Once
you export the file the history information might be useless anyhow.
A more serious concern is that RCS is not good at handling `$Log$'
entries when a branch is merged onto the main trunk. Conflicts often
result from the merging operation.
People also tend to "fix" the log entries in the file (correcting
spelling mistakes and maybe even factual errors). If that is done the
information from `cvs log' will not be consistent with the information
inside the file. This may or may not be a problem in real life.
It has been suggested that the `$Log$' keyword should be inserted
*last* in the file, and not in the files header, if it is to be used at
all. That way the long list of change messages will not interfere with
everyday source file browsing.
File: cvs.info, Node: Binary files, Next: Revision management, Prev: Keyword substitution, Up: Top
Handling binary files
*********************
There are two issues with using CVS to store binary files. The
first is that CVS by default convert line endings between the canonical
form in which they are stored in the repository (linefeed only), and
the form appropriate to the operating system in use on the client (for
example, carriage return followed by line feed for Windows NT).
The second is that a binary file might happen to contain data which
looks like a keyword (*note Keyword substitution::.), so keyword
expansion must be turned off.
The `-kb' option available with some CVS commands insures that
neither line ending conversion nor keyword expansion will be done. If
you are using an old version of RCS without this option, and you are
using an operating system, such as unix, which terminates lines with
linefeeds only, you can use `-ko' instead; if you are on another
operating system, upgrade to a version of RCS, such as 5.7 or later,
which supports `-kb'.
Here is an example of how you can create a new file using the `-kb'
flag:
$ echo '$Id$' > kotest
$ cvs add -kb -m"A test file" kotest
$ cvs ci -m"First checkin; contains a keyword" kotest
If a file accidentally gets added without `-kb', one can use the
`cvs admin' command to recover. For example:
$ echo '$Id$' > kotest
$ cvs add -m"A test file" kotest
$ cvs ci -m"First checkin; contains a keyword" kotest
$ cvs admin -kb kotest
$ cvs update -A kotest
$ cvs commit -m "make it binary" kotest # For non-unix systems
When you check in the file `kotest' the keywords are expanded. (Try
the above example, and do a `cat kotest' after every command). The `cvs
admin -kb' command sets the default keyword substitution method for
this file, but it does not alter the working copy of the file that you
have. The easiest way to get the unexpanded version of `kotest' is
`cvs update -A'. If you need to cope with line endings (that is, you
are using a CVS client on a non-unix system), then you need to check in
a new copy of the file, as shown by the `cvs commit' command above.
However, in using `cvs admin -k' to change the keyword expansion, be
aware that the keyword expansion mode is not version controlled. This
means that, for example, that if you have a text file in old releases,
and a binary file with the same name in new releases, CVS provides no
way to check out the file in text or binary mode depending on what
version you are checking out. There is no good workaround for this
problem.
You can also set a default for whether `cvs add' and `cvs import'
treat a file as binary based on its name; for example you could say
that files who names end in `.exe' are binary. *Note Wrappers::.
File: cvs.info, Node: Revision management, Next: Invoking CVS, Prev: Binary files, Up: Top
Revision management
*******************
If you have read this far, you probably have a pretty good grasp on
what CVS can do for you. This chapter talks a little about things that
you still have to decide.
If you are doing development on your own using CVS you could
probably skip this chapter. The questions this chapter takes up become
more important when more than one person is working in a repository.
* Menu:
* When to commit:: Some discussion on the subject
File: cvs.info, Node: When to commit, Up: Revision management
When to commit?
===============
Your group should decide which policy to use regarding commits.
Several policies are possible, and as your experience with CVS grows
you will probably find out what works for you.
If you commit files too quickly you might commit files that do not
even compile. If your partner updates his working sources to include
your buggy file, he will be unable to compile the code. On the other
hand, other persons will not be able to benefit from the improvements
you make to the code if you commit very seldom, and conflicts will
probably be more common.
It is common to only commit files after making sure that they can be
compiled. Some sites require that the files pass a test suite.
Policies like this can be enforced using the commitinfo file (*note
commitinfo::.), but you should think twice before you enforce such a
convention. By making the development environment too controlled it
might become too regimented and thus counter-productive to the real
goal, which is to get software written.
File: cvs.info, Node: Invoking CVS, Next: Administrative files, Prev: Revision management, Up: Top
Reference manual for CVS commands
*********************************
This appendix describes how to invoke CVS, and describes in detail
those subcommands of CVS which are not fully described elsewhere. To
look up a particular subcommand, see *Note Index::.
* Menu:
* Structure:: Overall structure of CVS commands
* ~/.cvsrc:: Default options with the ~/.csvrc file
* Global options:: Options you give to the left of cvs_command
* Common options:: Options you give to the right of cvs_command
* admin:: Administration front end for rcs
* checkout:: Checkout sources for editing
* commit:: Check files into the repository
* diff:: Run diffs between revisions
* export:: Export sources from CVS, similar to checkout
* history:: Show status of files and users
* import:: Import sources into CVS, using vendor branches
* log:: Print out 'rlog' information for files
* rdiff:: 'patch' format diffs between releases
* release:: Indicate that a Module is no longer in use
* rtag:: Add a tag to a module
* status:: Status info on the revisions
* tag:: Add a tag to checked out version
* update:: Bring work tree in sync with repository
File: cvs.info, Node: Structure, Next: ~/.cvsrc, Up: Invoking CVS
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 CVS program.
`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 -H' elicits a list of
available commands, and `cvs -v' displays version information on
CVS itself.
`command_options'
Options that are specific for the command.
`command_args'
Arguments to the commands.
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.
File: cvs.info, Node: ~/.cvsrc, Next: Global options, Prev: Structure, Up: Invoking CVS
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 -u
update -P
co -P
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 (*note Global options::.). For example the following line in
`.cvsrc'
cvs -z6
causes CVS to use compression level 6
File: cvs.info, Node: Global options, Next: Common options, Prev: ~/.cvsrc, Up: Invoking CVS
Global options
==============
The available `cvs_options' (that are given to the left of
`cvs_command') are:
`-b BINDIR'
Use BINDIR as the directory where RCS programs are located.
Overrides the setting of the `$RCSBIN' environment variable and
any precompiled directory. This parameter should be specified as
an absolute pathname.
`-T TEMPDIR'
Use TEMPDIR as the directory where temporary files are located.
Overrides the setting of the `$TMPDIR' environment variable and
any precompiled directory. This parameter should be specified as
an absolute pathname.
`-d CVS_ROOT_DIRECTORY'
Use CVS_ROOT_DIRECTORY as the root directory pathname of the
repository. Overrides the setting of the `$CVSROOT' environment
variable. *Note Repository::.
`-e EDITOR'
Use EDITOR to enter revision log information. Overrides the
setting of the `$CVSEDITOR' and `$EDITOR' environment variables.
`-f'
Do not read the `~/.cvsrc' file. This option is most often used
because of the non-orthogonality of the CVS option set. For
example, the `cvs log' option `-N' (turn off display of tag names)
does not have a corresponding option to turn the display on. So
if you have `-N' in the `~/.cvsrc' entry for `log', you may need
to use `-f' to show the tag names.
`-H'
Display usage information about the specified `cvs_command' (but
do not actually execute the command). If you don't specify a
command name, `cvs -H' displays a summary of all the commands
available.
`-l'
Do not log the cvs_command in the command history (but execute it
anyway). *Note history::, for information on command history.
`-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.
`-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 files read-only. Same effect as if the
`$CVSREAD' environment variable is set (*note Environment
variables::.). The default is to make working files writable,
unless watches are on (*note Watches::.).
`-s VARIABLE=VALUE'
Set a user variable (*note Variables::.).
`-t'
Trace program execution; display messages showing the steps of CVS
activity. Particularly useful with `-n' to explore the potential
impact of an unfamiliar command.
`-v'
Display version and copyright information for CVS.
`-w'
Make new working files read-write. Overrides the setting of the
`$CVSREAD' environment variable. Files are created read-write by
default, unless `$CVSREAD' is set or `-r' is given.
`-x'
Encrypt all communication between the client and the server. Only
has an effect on the CVS client. As of this writing, this is only
implemented when using a Kerberos connection (*note Kerberos
authenticated::.). Encryption support is not available by
default; it must be enabled using a special configure option,
`--enable-encryption', when you build CVS.
`-z GZIP-LEVEL'
Set the compression level. Only has an effect on the CVS client.