3.5. Adding Files to the RepositoryUse 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.
You can use cvs remove to remove a file that has been added but not committed. This command 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 resurrects 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.
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 has 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 "Keywords" and "Binary Files and Wrappers" later in this chapter. Example 3-14 shows use of cvs add to add directories and files. Figure 3-10 shows adding a file in Pharmacy. Example 3-14. Using cvs add
Figure 3-10. Using cvs add in Pharmacy |