Once you decide where you want your repository to be, you should point the CVSROOT environment variable to the repository location. For example:
After doing so, typing
setenv CVSROOT /mit/asksipb/cvstest
cvs initwill set up an empty repository. (You can also use the
-doption to specify a repository location instead of using CVSROOT, but CVSROOT is usually easier.)
Each CVS repository can have several projects. Now that your repository is ready, you can either import an existing directory structure or start from scratch.
To import an existing directory structure,
cd to the
directory, and type:
projectname controls where the project is stored in the repository. vendortag and releasetag aren't particularly important, but are still required. Your username for vendortag and
cvs import -m "imported directory" projectname vendortag releasetag
startfor releasetag would be reasonable defaults.
To start from scratch, create an empty project directory, and then follow the steps above.
To check out a project, you use the
command. As before, you either need to have CVSROOT defined, or use
-d option to specify the location of your repository.
cvs checkout projectname
After checking out a project, a subdirectory with the same name as the project you checked out will be made in your current working directory. It will contain all of the files in the project, and you can edit them at your leisure.
cvs commitcommand, or
cvs cifor short. For example:
When you specify a filename, you check in that file specifically. If no file is specified, you are checking in all of the files of the project that you have modified. The
cvs ci -m "Fixed a typo" intro.html
-mflag allows you to add a message to your commit. If
-mis not specified, CVS will invoke the editor pointed to in the
CVSEDITORenvironment variable, and ask you to type in a message.
If you are not using the most up to date version of the file, CVS will
not check in the file. You will need to run
as described below before reattempting the checkin.
This marks the file as a new file to be added. It is, however, not immediately added to the repository. To actually add it, you will also need to run:
cvs add filename
cvs updatecommand, or
cvs upfor short.
You may want to consider using the
-d option when you use
cvs update. This will ensure all directories in the
repository are also in your local copy, even if some directories were
added to the repository after you initially checked it out. The
-P option is also useful, as it will prune empty
directories from your local copy. CVS does not provide a way to
remove old directories, which is why this option can be necessary.
cvs update, you will have the most up-to-date
copy of the files in the repository. If other people have made
changes to the same file that you have been working on, their changes
will be merged into your local copy. If these changes conflict, CVS
will mark the differences with the lines "<<<<<<<", "=======" and
">>>>>>>". Look over the changes made, fix things as necessary,
and remove the line markers.
cvs diffcommand, with your filename as an argument. Without an argument, a
diffwill be performed on all of the modified files in your project. This is similar to
cvs log command will show you what changes
have been made to a particular file, like
rlog does in
C-x v v. When checking in a file, Emacs will open a buffer prompting you to enter a change comment. After entering your comment, C-c C-c will end your comment and check in the file.