C.2. Using CVS

C.2.1. Setting Up Your CVS Account

First you'll need to get an account at the LDP's CVS Repository. Please see the notes above on obtaining an account. This repository houses various documents including HOWTOs and Guides. Documents are sorted by the type of document (for example a HOWTO or a Guide), and by the markup language the document uses (for example DocBook or LinuxDoc).

When your account is ready you can log in using one of the following commands. In all instances your_userid should be replaced by the user name you were issued in the response email. You will be prompted for a password after this first step.

Initializing Your CVS Account

Linux system (two steps)

export CVSROOT=:pserver:your_userid@cvs.tldp.org:/cvsroot

(this can also be added to your ~/.bash_profile if you do not use any other CVS accounts.

cvs -d $CVSROOT login

Linux system (one step)

cvs -d :pserver:your_userid@cvs.tldp.org:/cvsroot login

Windows system

set CVSROOT=":pserver:your_userid@cvs.tldp.org:/cvsroot"

cvs -d %CVSROOT% login

Wait patiently while the system tries to log you in. It can often take more that 10-20 seconds for the system to either accept (or reject) your password. Once you've used cvs login for the first time and have been given access to the system, your password is stored in .cvspass and you will not have to use cvs login again. Just set the CVSROOT with the export command listed above and continue on. If TLDP's CVS server is the only one you work with, you might also add an export CVSROOT line to your ~/.bashrc shell configuration file.

C.2.2. Getting the Documents

You can get the entire repository with: cvs checkout LDP

Or you can get the source for your own document with: cvs checkout LDP/howto/docbook/YOUR-HOWTO.xml OR cvs checkout LDP/guide/docbook/YOURGUIDE

Windows users will need to use a modified version of this command. Instead they should use: cvs -d %CVSROOT% checkout LDP/howto/docbook/YOUR-HOWTO.xml

NoteKeep an overview
 

checkout will add the full directory structure from tldp.org on down. Although it doesn't really matter where you put these files on your local file system you may not want to bury the directories too deeply.

C.2.3. CVS Commands

CVS Commands: a brief reminder

commit

This CVS command will upload your changes to the CVS server.

Please be sure to include a useful description of the changes that have been made to your document.

If you want to bypass the editor screen you can use

cvs commit -m "A description of the work done on this version of the document."

NoteReady for publication warning
 

You must still email when you are ready to have your changes appear on the live site. Your email should include the relative path to the file(s) in the LDP CVS tree that you wish to update.

add

You can add new files to your CVS repository. These may be image files or additional XML files. First check that your HOWTO is in its own directory. You may want to coordinate with the people at to ensure you can add graphics or other files to your HOWTO.

Copy the files you want to add into your local CVS repository (where all of your downloaded/working files are). Then:

cvs add filename

After you've added the files, you still need to commit them to the repository (see above).

remove

$Id: cvs.xml,v 1.28 2004/07/15 14:20:00 emmajane Exp $

While this is not a CVS "command" it can be used to automatically insert information about the file including the time and date it was last modified, the version number it was assigned by the CVS and the filename of this particular file. The output will look like this: $Id: cvs.xml,v 1.9 2002/04/21 09:44:26 serek Exp $

If you need to change a file name, you still need to use the add command. First remove the copy of the file from your local disk. Then remove it from the CVS tree with: cvs remove filename. As with the add command, you need to >commit your removed file. Finally, now that the old file has been removed, add your new file using the instructions above (first add and then commit the additional file).

C.2.3.1. Recovering old versions

There you are, typing away, when you screw up. Real bad. Doesn't matter what it is, but suffice it to say that you've toasted not only the version on your local drive, but created a new version on the CVS server. What you need to do is go back in time and resurrect an older version of your file.

To do this, you'll need to know the version number of the file you want to retrieve. cvs diff will give a list of revisions if there are differences. You can pick the revision number, subtract one, and that is probably the revision you want to look at.

The command

cvs -Q update -p -r revision filename

will output to stdout the contents of the revision version of filename. You can pipe it to more or redirect the output to a file. Conveniently, you can redirect stdout to a file called filename. Your local file is now the revision you want, and

cvs update

will update the CVS server with the new (old) version of filename.