CVS is useful for the projects in this course. However, it becomes more important as there are more people and more files. For commercial development, it helps track version releases and bug fixes. CVS is just one version control system; there are several others that provide similar functionality, such as RCS (also UNIX).
The following example shows how to set up cvs.
Every member of the group must set up their environment. Since cvs is not installed in CEB 531, I have compiled it and made it available from my account. The first two commands set the path and man page path. The last command sets the location of the file repository, as shown in the next step (replace 'bob' with the user name of the person hosting the repository).
setenv PATH $PATH\:/ceb531/home/psomogyi/cvs/bin setenv MANPATH $MANPATH\:/ceb531/home/psomogyi/cvs/man setenv CVSROOT ~bob/ee552/project_repYou should put these lines in your ~/.cshrc file (or another script that you run before working on EE 552).
Then one person ('bob' in our example) creates the repository. This example assumes that there is an 'ee552' directory under the person's home directory. Also, if your project directory is called 'project' then rename it before going through this example. (Note that the 'esafe' (our project name) and 'release' tags in the 'cvs import' command are arbitrary). The repository directory must be accessable by all group members. See the File Sharing App Note for more details.
cd ~/ee552 mkdir project_rep mkdir project_rep/CVSROOT mkdir project cd project cvs import -m "Created repository." project esafe releaseThis has created a 'project' module in the repository. To actually use it, all members must checkout the module as shown below.
In order to get the 'project' directory, all group members must type:
cd ~/ee552 cvs checkout project cd projectThis will create the 'project' directory, which is currently empty.
To add your existing files to the repository, a member of your group should copy all the vhdl files to the project directory. You can put a log header into your files to show the changes people have made. To add the files to the repository, type:
cvs add *.vhd cvs commit -m "Initial revision."Now all other users can get the updated files by typing:
cvs updateFor descriptions of the cvs commit and update commands, see below.
-- chip.vhd -- $Log: $ -- library ieee;
Once this has been checked in twice, the header will look like:
-- chip.vhd -- $Log: chip.vhd,v $ -- Revision 1.2 1998/10/24 17:04:25 psomogyi -- Made many changes (this should actaully be descriptive). -- -- Revision 1.1 1998/10/24 17:03:42 psomogyi -- Initial revision. -- -- library ieee; uses ieee.something;
To add a new file, say chip.vhd:
cvs add chip.vhd cvs commit -m "Initial revision." chip.vhd
Once you've changed a file (say chip.vhd) and want to check it in, type:
cvs commit chip.vhdThis will also prompt you for a description of the changes you made. You can use the '-m' option to set the description from the command line:
cvs commit -m "Finally made it work." chip.vhd
To get updated versions of files that other people have changed, type:
cvs updateAny files that are different than in the repository will be listed. If there is a 'U' in front, then that file was updated from the file in the repository. If there is an 'M' then that file is different (presumably you editted your copy). If there is a '?', then that file does not exist in the repository.
If you are editing version 1.3 of a file, and you want to get version 1.2 back since you didn't like your changes for version 1.3, you can type:
cvs update -r"1.2" chip.vhdMake sure you specify the file or else you will get version 1.2 of ALL files! However, cvs knows that you are working with version 1.2, and not 1.3, so you will not be able to commit any changes if you edit the version 1.2 file. If you want to keep your changes, make a copy of the file, get the latest version back, copy your editted file overtop, and commit the file:
cp chip.vhd chip.vhd.12 cvs update -A chip.vhd cp chip.vhd.12 chip.vhd cvs commit chip.vhdIf you decide that you do want the version 1.3 file (or if you just got version 1.2 to look at it), then just type:
cvs update -A chip.vhdThis will put the latest version (1.3) of chip.vhd on your account.
If there is file, say chip.vhd, that you no longer want, you can remove it from the repository. To do this, type:
rm chip.vhd cvs remove chip.vhd cvs commit chip.vhdAt this point, the file is not actually deleted, but is moved to the $CVSROOT/project/Attic directory. So it is possible to "undelete" the file if you need to.
If you are using Emacs to edit your code, it is even easier to use CVS. Emacs can detect if a file is in CVS, and adds a new menu if it is. This menu contains options to check-in the file, to compare the file with previous versions, and other operations.