What is CVS – CVS is the Concurrent Versions System, the dominant open-source network-transparent version control system, that allows you to save and retrieve different development versions of source code. CVS is useful for everyone from individual developers to large, distributed teams:
- Its client-server access method lets developers access the latest code from anywhere there’s an Internet connection.
- Its unreserved check-out model to version control avoids artificial conflicts common with the exclusive check-out model.
- Its client tools are available on most platforms.
CVS is used by popular open-source projects like Mozilla, the GIMP, XEmacs, KDE, and GNOME.
So what’s it all about?
That’s all well and good, you might be saying, but what does it do for me? First, the basics: A version control system keeps a history of the changes made to a set of files. For a developer, that means being able to keep track of all the changes you’ve made to a program during the entire time you’ve been developing it. Have you ever lost a day’s work to an errant keystroke at the command line? A version control system gives you a safety net.
Version control systems are valuable for anyone, really. (After all, who couldn’t use a safety net?) But they’re usually used by software development teams. Developers working on a team need to be able to coordinate their individual changes; a central version control system allows that.
Code central station
Individual developers who want the safety net of a version control system can run one on their local machines. Development teams, however, need a central server all members can access to serve as the repository for their code. In an office, that’s no problem — just stick the repository on a server on the local network. For open-source projects…well, it’s still no problem, thanks to the Internet. CVS has built-in client-server access methods so that any developer who can connect to the Internet can access files on a CVS server.
In traditional version control systems, a developer checks out a file, modifies it, then checks it back in. The developer who checks out a file has exclusive rights to modify it. No other developer can check out the file — and only the developer who checked out the file can check in modifications. (There are, of course, ways for administrators to override that.)
Consider how exclusive checkouts might work: Bob’s Evil Twin checks out foo.java to add the comments he didn’t do when writing the code. Then he goes to lunch. Bob, working through lunch, finds that one of the bugs his boss assigned to him is in foo.java. He tries to check out foo.java…but the version control system won’t let him because his evil twin already has it checked out. Bob has to wait until his evil twin returns from lunch (two hours on a good day) before he can fix the bug.
In a large open-source project, with developers working late nights in any time zone, giving one developer the ability to prevent every other developer everywhere from working on any file clearly wouldn’t work. Eventually, they’d get fed up with not being able to work on a project when they want to.
CVS solves this problem with its unreserved check-out model: Checking out a file doesn’t give a developer exclusive rights to that file. Other developers can also check it out, make their own modifications, and check it back in.
“Wait!” you’re probably saying. “But don’t later check-ins overwrite earlier ones?” The quick answer is no. A longer answer is that CVS detects when multiple developers make changes to the same file and automatically merges those changes.
Whoa. Automatically? Don’t worry — CVS is cautious and will merge automatically only as long as the changes aren’t made to the same lines of code. If CVS can’t safely resolve the changes, the developer will have to merge them manually.
Where to from here?
By now, you’re undoubtedly drooling at the potential of CVS and can hardly wait to get started. The first step is to get CVS for your platform. Installing CVS is usually just a matter of unpacking it from the archive you downloaded. Configuring CVS can be a bit tricky and is highly dependent on your platform and where your CVS code repository is stored.