Department of Electronic Systems

Usage

Choosing the correct path to CVS

Before Alfred can use CVS, he must edit his .bashrc in his home directory in the following way:

  • Open the file and find a place where it says something with "export"
  • Write the line:
    export CVSROOT=/afs/ies.auc.dk/group/03gr781/CVS-root
  • Log out and in again to activate the changes.

Note: You will of course have to change 03gr781 to your own group number.

Check out a repository

To work with eg. the "report" repository you will first have to do a checkout of the repository. Only when you have a local copy of the report repository you can work with the files of the repository.

To do the checkout alfred writes:

 cvs checkout report 

cvs checkout: Updating report

 cd report 

Create a new file

If Alfred wants to add an existing file to the CVS repository, he must write:

cvs add filename

when he is in the directory of the file (which of course has to be a subdirectory of eg. the "report" directory). Next time "cvs commit" is run, the file will also be added in the master CVS repository.

If Alfred has a lot of files he wants to add he can just use

 cvs add

without filename and all the files in the current directory will be scheduled for addition.

Remove a file

If Alfred wants to remove a file in the CVS repository, he will have to erase the file in the normal way first:

rm filename

Then he can remove the file from the CVS repository:

cvs rm filename

Next time "cvs commit" is run, the file will also be deleted in the master CVS repository.

Rename a file

If Alfred wants to rename a file in the CVS repository, he will have to rename the file in the normal way first:

mv oldfilename newfilename

Then he can rename the file in the CVS repository:

cvs remove oldfilename
cvs add newfilename

Next time "cvs commit" is run, the file will also be renamed in the master CVS repository.

Getting the newest version

If Alfred wants to update the local copy to reflect the changes in the master CVS repository, he will have to write:

cvs update

which will update all the files and subdirectories in the current directory.

It is mandatory to do this before issuing a "cvs commit" because version conflicts will then be solved automagically.

Revision log

If Alfred wants to see the revision log for a particular file in the CVS repository, he writes:

cvs log filename

Differences between versions

If Alfred wants to see the difference between versions of a particular file in the CVS repository, he writes:

 cvs diff -c -r oldversion -r newversion filename

Committing changes

To commit changes made to Alfred's local copy to the master CVS-tree, he uses the command

 cvs commit filename

When commiting files an editor will be started enabling you to write a log message. This will be done for every file that is commitet. To add the same log message to a number of files a

 cvs commit -m 'log message' 

can be used.  

Cleaning Up

When Alfred is done editing and modifying the repository he wants to remove it to save some space. To do that he would do:

 cvs release -d report  

You have [0] altered files in this repository.
Are you sure you want to release (and delete) directory `report': y

This will make CVS check if there is any modified files, and if Alfred answers yes (as shown) the report directory will be erased. If Alfred wants to commit all the files in the directory he can use cvs commit without the filename and all the files in the directory will be commited.

Of course it is possible just to remove the directory by using the standard rm-command but since CVS keeps information about which directories are checked out it is recommended to use the cvs release-command.