CVS: Version Control Beyond RCS

If you have tried version control, but are frustrated by the need to set explicit locks every time you want to edit a file, or perhaps dislike being unable to edit a file when other developers have already locked a file, CVS is for you.
Contention

Now we turn to Westley, who will demonstrate how CVS is used when working on a multiple-person project.

Westley has been off the project for a month [ not too surprising, what with his having been dead and all]. The first thing he needs to do is bring his sources up to date.

cvs update

Since he has not modified anything since his last commit everything simply updates; no conflicts could exist. Now Westley would like to see what has happened since his departure on April 10. He uses the following command to view all the log messages for the commits that were made after April 10th:

cvs log -d>4/10 -b

After reviewing the log file he feels caught up, so he jumps right into modifying sources. During the course of his work he needs to create a new file, happiness.c. After he creates the file happiness.c on the disk, he issues the following command:

cvs add happiness.c

Westley also obsoletes a file, and after deleting the file, he issues the following command:

cvs delete agony.c

Both the add and delete commands will not take full effect until the CVS commit is done.

After a day of work, Westley has added a new feature and is ready to commit his modifications. He issues the following command:

cvs commit -m "Made a number of wonderful improvements"

CVS informs him that someone else has already committed changes to some of the files that he has made changes to, so he must update his files with the other developer's changes before committing his own. A simple call to the update command will do this:

cvs update

After manually editing to resolve any conflicts between his changes and the changes already made to the repository, Westley tests his new feature again. Everything looks okay, so he attempts his commit again:

cvs commit -m "Made a number of wonderful improvements"

This time it works. This method of working is quite an improvement over many systems where a person must first lock a file before it can be edited, and anyone else wanting to edit the file must wait until the first person has committed changes and unlocked the file.

Releases

Now Buttercup will demonstrate how to release a new version of the software. She begins by checking out the latest sources.

cvs checkout mousetrap

After verifying that these sources are the exact versions that should be released, she tags the release:

cvs tag PROD_REL4-1

Then she creates a set of directories containing all of the sources to be delivered by using the export command:

cvs export -R PROD_REL4-1 mousetrap

This will create a directory structure filled with only the correct sources and none of the CVS administration directories or files.

Summary

The full power of CVS exceeds the scope of this article, but I hope I have provided enough of a taste to entice you to try CVS. We have been using it for 5 months at Lernout & Hauspie, and are more than pleased with its performance.

Per Cederqvist has written an excellent introduction to CVS called Version Management with CVS. It can be found on the WWW by following links on the CVS page at http://www.winternet.com/~zoo/cvs/. This manual will be included with the next version of CVS, version 1.4.

For prior adventures of this software development team, see (or read) William Goldman's The Princess Bride.

Tom Morse (tmorse@lhs.com) has been working in Unix for the past 10 years and is currently employed at Lernout & Hauspie Speech Products. When he is not chained to a computer, he spends his time mountain biking, hiking, and attempting to learn Dutch.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix