[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Because renaming files and moving them between directories is somewhat inconvenient, the first thing you do when you start a new project should be to think through your file organization. It is not impossible to rename or move files, but it does increase the potential for confusion and CVS does have some quirks particularly in the area of renaming directories. See section 7.4 Moving and renaming files.
What to do next depends on the situation at hand.
3.1 Setting up the files | Getting the files into the repository | |
3.2 Defining the module | How to make a module of the files |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The first step is to create the files inside the repository. This can be done in a couple of different ways.
3.1.1 Creating a directory tree from a number of files | This method is useful with old projects where files already exists. | |
3.1.2 Creating Files From Other Version Control Systems | Old projects where you want to preserve history from another system. | |
3.1.3 Creating a directory tree from scratch |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When you begin using CVS, you will probably already have several
projects that can be
put under CVS control. In these cases the easiest way is to use the
import
command. An example is probably the easiest way to
explain how to use it. If the files you want to install in
CVS reside in `wdir', and you want them to appear in the
repository as `$CVSROOT/yoyodyne/rdir', you can do this:
$ cd wdir $ cvs import -m "Imported sources" yoyodyne/rdir yoyo start |
Unless you supply a log message with the `-m' flag, CVS starts an editor and prompts for a message. The string `yoyo' is a vendor tag, and `start' is a release tag. They may fill no purpose in this context, but since CVS requires them they must be present. See section 13. Tracking third-party sources, for more information about them.
You can now verify that it worked, and remove your original source directory.
$ cd .. $ cvs checkout yoyodyne/rdir # Explanation below $ diff -r wdir yoyodyne/rdir $ rm -r wdir |
Erasing the original sources is a good idea, to make sure that you do not accidentally edit them in wdir, bypassing CVS. Of course, it would be wise to make sure that you have a backup of the sources before you remove them.
The checkout
command can either take a module
name as argument (as it has done in all previous
examples) or a path name relative to $CVSROOT
,
as it did in the example above.
It is a good idea to check that the permissions
CVS sets on the directories inside $CVSROOT
are reasonable, and that they belong to the proper
groups. See section 2.2.2 File permissions.
If some of the files you want to import are binary, you may want to use the wrappers features to specify which files are binary and which are not. See section C.2 The cvswrappers file.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If you have a project which you are maintaining with another version control system, such as RCS, you may wish to put the files from that project into CVS, and preserve the revision history of the files.
The RCS file should not be locked when you move it into CVS; if it is, CVS will have trouble letting you operate on it.
Failing that, probably your best bet is to write a script that will check out the files one revision at a time using the command line interface to the other system, and then check the revisions into CVS. The `sccs2rcs' script mentioned below may be a useful example to follow.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For a new project, the easiest thing to do is probably to create an empty directory structure, like this:
$ mkdir tc $ mkdir tc/man $ mkdir tc/testing |
After that, you use the import
command to create
the corresponding (empty) directory structure inside
the repository:
$ cd tc $ cvs import -m "Created directory structure" yoyodyne/dir yoyo start |
Then, use add
to add files (and new directories)
as they appear.
Check that the permissions CVS sets on the
directories inside $CVSROOT
are reasonable.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The next step is to define the module in the `modules' file. This is not strictly necessary, but modules can be convenient in grouping together related files and directories.
In simple cases these steps are sufficient to define a module.
$ cvs checkout CVSROOT/modules $ cd CVSROOT |
tc yoyodyne/tc |
$ cvs commit -m "Added the tc module." modules |
$ cd .. $ cvs release -d CVSROOT |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |