su2 :: software · texts · graphics · photography · uni · me · links

up

CVS Mini Howto


This Howto describes how to access a CVS repository in Linux/Unix. The examples I used are the settings for Kmud but it should be easy to adapt it for other repositories.

First make sure that you have the cvs tool installed. Then set an environment variable (for bash: export) named CVSROOT with the value :pserver:account@barney.cs.uni-potsdam.de:/home/cvs/kmud. The account@.. means you'll connect as user "account". Change it to your username of the account created for you. This is just a CVS account, no real login to the machine. barney.cs.uni-potsdam.de is the CVS server and /home/cvs/kmud the directory of the repository there.

To log in just type cvs login. The password you are asked for is your chosen (or given) CVS password. Note: this is nothing really top secret, with CVS nobody can really delete something. It's always possible to restore files to an old state.

Now chose a subdirectory where you want to work on the sources. Go into that directory and type cvs checkout kmud2. This downloads a complete new copy of the files. "kmud2" is the module called in the repository (it's possible to create any number of modules). Now there should be a directory CVS and one named kmud2. In kmud2 again a subdirectory CVS and a number of files. In the CVS directories are some information stored for CVS. Do not delete or change something there.

The files in the kmud2 directory are the ones of interest and which you can modify now. If you want to apply changes of your local files to the CVS repository, then type cvs commit. You'll be in a vi-like editor (or whatever you set as $EDITOR) where you can comment on what you have changed. Please always do so (and describe exactly) so that others know what you did.

Now if somebody else changed something, and you want to have these changes in your local directory, then type cvs update -dP. That way all files (in the directory where you are and below) will be synched with the server. This means also that files which didn't exist before (either because they were added to the cvs or you deleted them locally) will be created. So if you messed up a file in a way that you wish you would have the original file again, then just remove the file and make an update. This update should be done every time you start working on the files and once before you commit changes.

When you created a new file and you want this file go into CVS, then type cvs add file. It will be sent to the CVS server with the next commit. cvs remove is the matching opposite to add. Before you can cvs remove a file you have to delete it (physically, from harddisk) before.

Well, that are the main and most important commands. For paranoia-freaks there is also a cvs logout. After a cvs login your password will be stored in ~/.cvspass (only hashed, no strong encryption). But if you logout you have to login next time again and because nobody can do much harm (other than making changes as your account, which can be reverted) you can save the keystrokes and keep logged in. Alternatively to the $CVSROOT environment variable you can also set the option "-d :pserver:account@barney.cs.uni-potsdam.de:/home/cvs/kmud".

For more extended information there is the cvs manpage and a very good FAQ for CVS.

There are graphical frontends for CVS. I know for example Cervisia. It's great for visualizing certain things (like what has changed between version X and Y) but I prefer the command line tool for the day to day work.


1grey

Copylight (cc) 2001-2018 Stephan Uhlmann. Last change: 2002-05-01
Verbatim copying and distribution are permitted, provided this notice is preserved.