Click here to Skip to main content
12,953,230 members (81,354 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 18 Aug 2010

CVS: Getting into the mind of CVS and how it works

, 18 Aug 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
Getting into the mind of CVS and how it works

Since some of my posts discuss manipulating CVS backend files, it is important to now explain a little bit about the way CVS works.

CVS only cares about its own copy of the code in $CVSROOT. Each folder under $CVSROOT is called a module. The files in here are kept in the same structure with the same filenames, EXCEPT every file has a ",v" at the end of it. No need to go into why, just understand that these are the backend files of files under CVS control and that each ",v" file contains all the version history of the file in it. Developers should NEVER be here, never look here, and I have probably done wrong just telling you about it because your curiosity may cause you to go look in this folder. Screwing up something here can be disastrous.

So why doesn't CVS care about your files? It doesn't need to until you try to do something using the "cvs" command. First you do a checkout to get code to your local area to work on.

$ cvs co <module>

The "co" is a shortcut for "checkout" but either can be used. This will get the latest copy of the code out of CVS, called the HEAD...or the HEAD of the TRUNK. We can talk more about HEAD, TRUNK, BRANCH later when we talk about proper revision control.

Once the code is checked out, you will notice a CVS sub-folder in every directory. This CVS folder contains the information about:

  1. Where the CVS repository is (can even be on a remote machine -- this may hardcode usernames)
  2. What module you have checked out from the repository
  3. What tag/branch if any
  4. What versions of every file is checked out

If this CVS folder gets deleted, there is no link back to CVS. When you do a commit to CVS, it goes into this folder and looks up the data on where to put the files. It will also do checks to make sure you have the latest code prior to allowing you to commit. There is a nuance to be aware of when using code on remote servers: If $CVSROOT is on a remote machine, then your Root file in CVS folder probably contains a :pserver: line with your username hardcoded. This means that, if you are sharing code with another developer (copy and paste whole directories), they will get your username all over the place. I wrote another blog post on how to quickly correct this problem. If the CVS repository is on the same server as you are checking out code to, this problem isn't manifest.

We'll talk more in later posts about how to manipulate CVS in the backend for restructuring code. This a dangerous, but occasionally necessary task.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Chief Endian
Chief Technology Officer Chiefs And Endians
United States United States
Come visit us at

A compilation of varied technical gems learned over many years of experience in the industry.

Hint for the confused: Endian is a Computer Science term--the title is a play on words, not a misspelling.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 18 Aug 2010
Article Copyright 2010 by Chief Endian
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid