Previous section   Next section

3.6 Adding Files to the Repository

Use cvs add to add a file or directory to the repository. Using cvs add on a file marks the file as needing to be added when cvs commit is run. Running cvs add on a directory adds the directory to the repository and the CVS subdirectory to the directory.

The Attic and CVS directories are special directories that CVS uses for its own purposes. Do not make a file or directory with these names.

If you attempt to commit and get an error message that includes *PANIC* administration files missing, you may have created a file or directory named CVS. This message means that CVS could not find the Repository file in the CVS subdirectory of the sandbox directory it is trying to commit.

You can use cvs remove to remove a file that has been added but not committed. This removes the marking in the CVS subdirectory and doesn't record the aborted addition in the repository's history. Similarly, you can use cvs add to abort a file removal; it will resurrect the file without recording the aborted removal.

The file or directory to be added must exist within the sandbox, and a directory must not contain a file or subdirectory named CVS.

Files and directories are case-sensitive in the repository. If you are using a CVS client or operating system that is not case-sensitive, you may encounter problems. Avoid using file or directory names that would be the same if case were not an issue.

In the process of adding a file, CVS strips trailing slashes and any special CVS files from the arguments, then checks for name conflicts (including some case-comparison testing). If CVS detects a name conflict, it notifies the user and does not add the file or directory.

cvs add uses the following syntax:

cvs [cvs-options] add [command-options] filename

The available options are -k, followed by any of the keyword flags, and -m, followed by an addition message. Keyword flags set default keyword-substitution modes. The most common keyword flag used with cvs add is -kb, used to add binary files. Any message specified using -m becomes the description message for the file (displayed in cvs log output) and is stored with the file when the file is committed. At least one filename must be used, and the file or directory to be added must exist.

Keyword modes that are arguments to cvs add combine to become the default mode for the file. See Section 3.10 and Section 3.11 later in this chapter.

Example 3-14 shows using cvs add to add directories and files.

Example 3-14. Using cvs add
bash-2.05a$ cvs add design plan design/*.rtf plan/*.rtf 
    
Directory /var/lib/cvs/wizzard/doc/design added to the repository
Directory /var/lib/cvs/wizzard/doc/plan added to the repository
   
cvs server: scheduling file `design/Analysis.rtf' for addition
cvs server: scheduling file `design/Specification.rtf' for addition
cvs server: scheduling file `plan/Schedule.rtf' for addition
cvs server: use 'cvs commit' to add these files permanently

Special Files

CVS can store only files that can be converted to RCS format. Files cannot be added to the repository if they are actually devices, symbolic links, or other files that are not persistent or that cannot be opened or modified. To record these files as part of your project, include the commands to construct them in your build or installation scripts and store those scripts in CVS.


  Previous section   Next section
Top