PDA

View Full Version : What is CVS?


viscousmemories
04-01-2005, 01:43 AM
My roommate finally convinced me to start using CVS on the Linux server we have here at home to manage the forum software. So far I haven't had any trouble keeping control of the hacks and modifications we've made to vBulletin, but as time goes by it will become more and more important to have a stable management system. So I've spent the last few days reading about and setting up CVS here at home, and just thought I'd share a tiny bit of what I've learned. Please feel free to correct or clarify any of this.

What is CVS

CVS stands for Concurrent Versioning System.

In short, CVS is a computer program that facilitates project development and collaboration by keeping an ongoing record of changes to data files.

Say for example you are a writer, and you're working on the Great American Novel. Every day you open the story.txt file on your computer and work on the story. Most of the time you'll probably just add on to what's there, but other times you might go back and modify or remove something you wrote previously. In any case, when you're done working on the story you'll save the file, and the next time you open it you'll see it just as it was after your last edit.

Now imagine that one Friday afternoon you're proofing one of the later chapters of the story and it dawns on you that on Monday you had deleted a large section of Chapter Two that you had thought superfluous, but was in fact an important prelude to something that happens in Chapter Seven. Wouldn't it be nice if you had a copy of the story just as it was on Monday, so you could just click a button and restore that section, but without losing the changes you'd made since?

That's just one of the myriad uses CVS has.

Now, if you really are a writer, you're probably thinking something like "Microsoft Word already gives me the power to track changes to a document. I have no use for CVS!"

Well truth be told, if all you needed was to track edits to a single file I'd say you're probably right. But where CVS really shines is not managing changes to a single document file, but managing changes to multiple files related to a single computer programming project.

Here's how it works:

The system administrator creates a CVS "repository" on a file server.
You import your programming project into CVS.
When you want to edit the program you "checkout" the files you want to work on.
When you're done making changes you "commit" the files back to CVS.


And in grossly oversimplified terms, here's what that means:

The system administrator creates a directory (folder) on the server.
You copy your original program files into that directory.
When you want to make changes you get copies of the originals from the server and edit them.
When you're done working on the files you copy them back to the server and CVS records the changes.


Not only does this allow you to revert to any last known saved version of a file or collection of files as needed, but there are also numerous collaboration features built in that allow many people to work on the same set of files simultaneously without overwriting each others changes.

Godless Wonder
04-01-2005, 03:49 AM
Yeah, CVS kicks some ass, doesn't it? I did some development on CVS some years ago. For awhile I had some patches that gave the trunk a real name, and let you refer back to the origin of a branch in case you forgot to tag it, but I never got them into the main codebase. I think Subversion is aiming to take over CVS, but last I checked they don't have support for branching, which is a pretty major deficiency. Of course CVS's support for branching isn't all that great. Tracking multiple merges can quickly become a nightmare, esp. with large codebases with lots of people.

A neat CVS trick to get an inventory of files that have a particular tag is:

cvs rdiff -s -r 0 -r tag module

(You won't find that in the manual.)

If you ever have some specific question about CVS, there's a good chance I could answer it. There's also the CVS mailing list, "info-cvs", also searchable via google (http://groups-beta.google.com/group/fa.info-cvs), highly recommended if you're the main CVS go-to guy for a group of people.

Sort of related, sort of not, Andrew Morton (maintainer of the 2.4. linux kernel tree, iirc) has a set of patch management scripts that are pretty cool (though the learning curve is a bit steep, and you can get yourself into trouble with them. But if you are used to CVS, and have to deal with people that use Visual Source Safe, or some other, it can be a great way to sort of CVS-ify the development experience by allowing similar sort of "cvs update" enabled concurrent development. Andrew's patch scripts are here. (http://www.zip.com.au/~akpm/linux/patches/) Pretty different from CVS, in a way, but they definitely have their place. I use them all the time. They're good for maintaining patches to CVS trees to which you don't have commit access, or to source code that is existing in multiple, forked CVS trees (common in giant companies like HP (nee Compaq (nee Digtal))) The documentation, such as it is is in the "docco.txt" file. I worked on those scripts a tiny bit, I wrote the "pstatus" command. Oh, yeah, I should mention... As I recall, the scripts indiscriminately write files in /tmp without unique names, so two users on the same system can clobber each other, which is pretty terrible. But these days, everybody has a system to themself for the most part.)

viscousmemories
04-01-2005, 03:57 AM
Wow, cool. I'm sure I'll get stumped eventually. I'm not really a programmer. I corrupted all the forum images by importing the whole directory before I learned about forcing the -kb switch in the cvswrappers file, for example. :D

Fortunately I'm studious about making backups.

I'll see your edit and call. :D

I probably won't have any use for those scripts personally, but who knows? Maybe I'll actually learn this here programming stuff and find a use for them eventually. Thanks for the info.

Ensign Steve
04-01-2005, 07:17 AM
I thought CVS was a pharmacy.

For real. :eh?:

JoeP
04-01-2005, 10:30 AM
Cool description.

Not only is it also a pharmacy, it's:
Antisubmarine aircraft carriers (CVS), United States Navy's hull classification symbol.
Cardiovascular System
Computing Verification Systematics
Chorionic villus sampling, a form of prenatal testing
Computer Vision Syndrome
CVS/pharmacy, a convenience store and pharmacy chain in the United States
Cyclic Vomiting Syndrome, an illness

Ensign Steve
04-01-2005, 11:16 AM
I hate when my vomitting is cyclic.

(sorry for messing up your thread, tom. you can feel free to ravage my TCP/IP thread once I start it)

viscousmemories
04-01-2005, 03:47 PM
Are you kidding? I'm glad someone bothered to read it (or at least open it). Any responses are a bonus. :)

Ensign Steve
04-01-2005, 10:07 PM
I'm glad someone bothered to read it (or at least open it).

Hehe. Nice save.

seebs
04-01-2005, 11:59 PM
I keep character sheets for RPGs in CVS.

squian
04-03-2005, 04:10 AM
CVS? Who's still using that aging program for version control. Aren't all the cool people using subversion (http://subversion.tigris.org/) these days?

(Am I a jerk for recommending CVS to vm in the first place and then adding this to his thread?)

livius drusus
04-03-2005, 04:11 AM
:yup:

Godless Wonder
04-03-2005, 07:56 AM
CVS? Who's still using that aging program for version control.
People who have gigantic ten-year-old codebases and build processes built around CVS.

So does subversion implement branching and everything now? I see it mentioned as a feature on their web page now... last time I checked (long time ago) they didn't have branching done. Bleeding edge version control systems aren't for people who take configuration control seriously. Subversion may well be fine, but it kind of still has new-car smell. ;)

Corona688
04-03-2005, 09:18 AM
CVS? Who's still using that aging program for version control. Aren't all the cool people using subversion (http://subversion.tigris.org/) these days?subversion is what's new and hot. I never really liked CVS, the idea is sound but the implimentation is cumbersome. But that doesn't mean CVS gets thrown out, plenty of things large and small are using it.

viscousmemories
04-03-2005, 07:20 PM
I corrupted all the forum images by importing the whole directory before I learned about forcing the -kb switch in the cvswrappers file, for example.
Yeah, I'm quoting myself. :blush:

For future reference (mine and others): Flash files (.swf, like the arcade games) are also binary.

Godless Wonder
04-07-2005, 04:30 PM
Interestingly (or not) it looks like Linus is not using bitkeeper anymore (http://groups-beta.google.com/group/linux.kernel/browse_frm/thread/ec4dd1ae6dc0f83b/0ec9335e1dbed093#0ec9335e1dbed093) and advises people to look into monotone (http://www.venge.net/monotone/) which I've never heard of (though I had heard of savannah (http://savannah.nongnu.org/projects/monotone)) Linus does not seem to be impressed with subversion.