CVS
Overview |
|
CVS
- Concurrent Versions System
|
Creating
a Repository |
|
Before using CVS, you first must
create a repository to store your codebase in. cvs -d ~/CVS init
Where ~/CVS is the path where you want the repository to be. (This
should be an empty directory to start with). You can also specify the
directory in the environment variable CVSROOT:setenv CVSROOT ~/CVS
In general, all interaction you'll have with the repository will be
through the program, cvs. In other words, don't try to do any CVS
operations from inside the repository (at best they won't work). |
Starting
a Project |
|
Adding a comment to your CVS
operation.... To start a project (also known as a module), you have to import your first into your repository: cvs import module_name vendor_tag
release_tag
Where module_name is the name of the project/module that you desire, vendor_tag is a name describing the source of the file(s) being imported (intended for when you starting from source code acquired from an outside vendor), and release_tag is a name to be used to denote the state of the source after this import (use of releases tag will be covered later in the course). Note: import will take everything in the current directory and place it into you repository, doing this in an empty directory is recommend. (Doing it in ~/ is not a very good idea). |
Checking
out your source code |
|
To start working on your source
code, you must first check it out of the repository: cvs checkout module_name
This will create a directory called module_name in the current directory. It will contain a directory CVS (as will its subdirectories), which contains bookkeeping information. This directory, is often referred to as your working directory. |
Modifying
your source code |
|
In your working directory,
modify the files as your desire, if you want to create a new file or
delete one, you have to tell cvs to add/remove it from the repository: cvs add file_name
cvs remove file_name At any point, you can do a cvs update: cvs update
to syncronize your working directory with the repository. If any files
have been changed in the repository since your last checkout/update,
your local copy will be updated. |
Commiting
your changes |
|
To finalize your changes, you
must perform a commit: cvs commit
In the case that the files that you are committing have changed since
your last update/checkout, cvs will attempt to automatically merge the
changes you have made with the respository version. In the case that it
cannot do so automatically, you will be prompted to merge the files by
hand. |
File
Permissions |
|
On a related note, when setting
up your development environment, check the file permissions on your
home directory and CVS tree. Make sure that only you have the
permission to read these directories. If not, use chmod to fix it. For
example: chmod og-r ~/ This command will make everyone other than the owner of the your home directory (persumably you) unable to read it. The commandline option, -R will make chmod update the permissions of the target, recursing down subdirectories. Read the man page for umask |
Exercises |
|
Create a CVS Repository Import a file into it Checkout the file Modify it Commit your change Remove the file from the repository Check the file permissions on you home directory and your CVS Repository, correct them if necessary. Hand in the output of the command'cvs log' from your working directory and directory listing showing the permissions on your home directory and CVS Repository. Specifically: ls -al ~/ > directory_listing cvs log > cvs_logfile The latter has to be done in the directory that checkout produced. Feel free to edit directory_listing, so that it doesn't list all the files in your home directory, leaving the listing for ./ and CVS |