Importing an existing source tree

It's probably easy to see that adding an existing source tree to CVS using the sequence of add and commit commands outlined above is tedious for more than a couple of files. In these cases, we'll use the import command. We'll cover the most basic use of this command in this section. Later on, we'll look at some more advanced things that you can do with it.

The import command assumes you have a directory tree somewhere on your disk. It must not be in either your repository or your local copy of the repository. To add the entire tree to your CVS repository, use the following format:

cd source_to_add
cvs -drepository_path import path_in_repository vendor init

and provide a comment when the editor appears.

This may seem a little odd at first, but the import command has other uses than simply importing. It always imports the contents of the current working directory. The path_in_repository tells CVS to create this path within the repository and to put the contents of the current directory there.

CVS uses the last two arguments—vendor and init—to create a branch (see "Concurrent development: branching and merging" later in this chapter) and a tag for the imported files. They aren't applicable if you're importing your own software, but CVS requires them anyway.