- •Overview
- •What is CVS?
- •What is CVS not?
- •A sample session
- •Getting the source
- •Committing your changes
- •Cleaning up
- •The Repository
- •Telling CVS where your repository is
- •How data is stored in the repository
- •File permissions
- •The attic
- •The CVS directory in the repository
- •CVS locks in the repository
- •How data is stored in the working directory
- •Multiple repositories
- •Creating a repository
- •Backing up a repository
- •Moving a repository
- •Remote repositories
- •Server requirements
- •Connecting with rsh
- •Direct connection with password authentication
- •Setting up the server for password authentication
- •Using the client with password authentication
- •Security considerations with password authentication
- •Direct connection with GSSAPI
- •Direct connection with Kerberos
- •Connecting with fork
- •Read-only repository access
- •Temporary directories for the server
- •Starting a project with CVS
- •Creating Files From Other Version Control Systems
- •Creating a directory tree from scratch
- •Revisions
- •Revision numbers
- •Versions, revisions and releases
- •Assigning revisions
- •Specifying what to tag from the working directory
- •Specifying what to tag by date or revision
- •Deleting, moving, and renaming tags
- •Sticky tags
- •Branching and merging
- •What branches are good for
- •Creating a branch
- •Accessing branches
- •Branches and revisions
- •Magic branch numbers
- •Merging an entire branch
- •Merging from a branch several times
- •Merging and keywords
- •Recursive behavior
- •Removing directories
- •The Normal way to Rename
- •Moving and renaming directories
- •History browsing
- •Log messages
- •The history database
- •Multiple developers
- •File status
- •Informing others about commits
- •Several developers simultaneously attempting to run CVS
- •Telling CVS to notify you
- •Information about who is watching and editing
- •Using watches with old versions of CVS
- •Choosing between reserved or unreserved checkouts
- •Revision management
- •When to commit?
- •Keyword substitution
- •Keyword List
- •Using keywords
- •Avoiding substitution
- •Substitution modes
- •Problems with the $Log$ keyword.
- •Tracking third-party sources
- •Updating with the import command
- •Reverting to the latest vendor release
- •How to handle keyword substitution with cvs import
- •Multiple vendor branches
- •How your build system interacts with CVS
- •Special Files
- •Index
Chapter 2: The Repository |
17 |
The most important of these files is the ‘modules’ file. It defines all modules in the repository. This is a sample ‘modules’ file.
CVSROOT |
CVSROOT |
modules |
CVSROOT modules |
cvs |
gnu/cvs |
rcs |
gnu/rcs |
diff |
gnu/diff |
tc |
yoyodyne/tc |
The ‘modules’ file is line oriented. In its simplest form each line contains the name of the module, whitespace, and the directory where the module resides. The directory is a path relative to $CVSROOT. The last four lines in the example above are examples of such lines.
The line that defines the module called ‘modules’ uses features that are not explained here. See Section C.1 [modules], page 135, for a full explanation of all the available features.
2.4.1 Editing administrative files
You edit the administrative files in the same way that you would edit any other module. Use ‘cvs checkout CVSROOT’ to get a working copy, edit it, and commit your changes in the normal way.
It is possible to commit an erroneous administrative file. You can often fix the error and check in a new revision, but sometimes a particularly bad error in the administrative file makes it impossible to commit new revisions.
2.5 Multiple repositories
In some situations it is a good idea to have more than one repository, for instance if you have two development groups that work on separate projects without sharing any code. All you have to do to have several repositories is to specify the appropriate repository, using the CVSROOT environment variable, the ‘-d’ option to cvs, or (once you have checked out a working directory) by simply allowing cvs to use the repository that was used to check out the working directory (see Section 2.1 [Specifying a repository], page 7).
The big advantage of having multiple repositories is that they can reside on di erent servers. With cvs version 1.10, a single command cannot recurse into directories from di erent repositories. With development versions of cvs, you can check out code from multiple servers into your working directory. cvs will recurse and handle all the details of making connections to as many server machines as necessary to perform the requested command. Here is an example of how to set up a working directory:
cvs -d server1:/cvs co dir1 cd dir1
cvs -d server2:/root co sdir cvs update
The cvs co commands set up the working directory, and then the cvs update command will contact server2, to update the dir1/sdir subdirectory, and server1, to update everything else.
18 |
CVS—Concurrent Versions System v1.11.21 |
2.6 Creating a repository
This section describes how to set up a cvs repository for any sort of access method. After completing the setup described in this section, you should be able to access your cvs repository immediately via the local access method and several remote access methods. For more information on setting up remote access to the repository you create in this section, please read the section on See Section 2.9 [Remote repositories], page 19.
To set up a cvs repository, first choose the machine and disk on which you want to store the revision history of the source files. CPU and memory requirements are modest, so most machines should be adequate. For details see Section 2.9.1 [Server requirements], page 19.
To estimate disk space requirements, if you are importing RCS files from another system, the size of those files is the approximate initial size of your repository, or if you are starting without any version history, a rule of thumb is to allow for the server approximately three times the size of the code to be under cvs for the repository (you will eventually outgrow this, but not for a while). On the machines on which the developers will be working, you’ll want disk space for approximately one working directory for each developer (either the entire tree or a portion of it, depending on what each developer uses).
The repository should be accessible (directly or via a networked file system) from all machines which want to use cvs in server or local mode; the client machines need not have any access to it other than via the cvs protocol. It is not possible to use cvs to read from a repository which one only has read access to; cvs needs to be able to create lock files (see Section 10.5 [Concurrency], page 67).
To create a repository, run the cvs init command. It will set up an empty repository in the cvs root specified in the usual way (see Chapter 2 [Repository], page 7). For example,
cvs -d /usr/local/cvsroot init
cvs init is careful to never overwrite any existing files in the repository, so no harm is done if you run cvs init on an already set-up repository.
cvs init will enable history logging; if you don’t want that, remove the history file after running cvs init. See Section C.9 [history file], page 148.
2.7 Backing up a repository
There is nothing particularly magical about the files in the repository; for the most part it is possible to back them up just like any other files. However, there are a few issues to consider.
The first is that to be paranoid, one should either not use cvs during the backup, or have the backup program lock cvs while doing the backup. To not use cvs, you might forbid logins to machines which can access the repository, turn o your cvs server, or similar mechanisms. The details would depend on your operating system and how you have cvs set up. To lock cvs, you would create ‘#cvs.rfl’ locks in each repository directory. See Section 10.5 [Concurrency], page 67, for more on cvs locks. Having said all this, if you just back up without any of these precautions, the results are unlikely to be particularly dire. Restoring from backup, the repository might be in an inconsistent state, but this would not be particularly hard to fix manually.
When you restore a repository from backup, assuming that changes in the repository were made after the time of the backup, working directories which were not a ected by the