Kleines How-To fuer CVS

Quick Guide to using CVS Updated: 2000.11.30

Using existing code modules; Basic checking in and out of files

A CVS module is essentially a directory sub-tree which has been imported into CVS.
When you check-out a module, you get a complete copy of the entire sub-tree, placed wherever you are,
in which you can edit the sources.

For the following examples, CVS is installed on a machine "dev" with the CVSROOT as /usr/local/cvs,
so you must set a CVSROOT environment variable thusly:

In your .bashrc, add the following snippet:

export CVSROOT=/usr/local/cvs if [ uname -n != 'dev' ]; then

fi

Then in your home directory (or wherever you would like to work), do something like:

    example> cd
    example> cvs checkout test
    example> cd test
    example> emacs bla
            ......
    example> cvs commit bla

This will create a directory called 'test', you can enter it, edit your files, then commit your changes.
If you wanted to discard your changes instead of committing them, you can delete the
local copy and reload the stored one:

    example> rm bla
    example> cvs update 

Or, if you want to completely get rid of a file:

    example> rm bla
    example> cvs remove bla

Adding new files, symbolic tagging

If you want to create a new file:

    example> emacs bla2
            ......
    example> cvs add bla2
    example> cvs commit bla2

To 'tag' a version, i.e. to give the currently commited set a version name:

    example> cvs tag phantomwarerelease test

Then within some other directory, you can export the version. This creates a complete copy without
any of the version control:

    example> cvs export -r phantomwarerelease test

Checking revision history, comments

To show all the modifications of a file 'FooBar.pm' by you and by anyone respectively:

    example> cvs history -x M FooBar.pm
    example> cvs history -x M -a FooBar.pm

To see every tag for FooBar.pm by anyone:

    example> cvs history -xWFUMGCAR -a FooBar.pm

To show all the comments for that file:

    example> cvs log FooBar.pm

To sync up all the tag numbers for the files in the current directory:

    example> cvs commit -r1.50

Using CVS auto-variables

You can (& should) put something like the following near the top of your file. The
Things between $... $ get filled in by CVS accordingly upon committing, and make
it easy to keep track of versions out of the context of a working directory.


Creating new code modules

To create a new code module in the cvs repository, cd into the directory containing the sources, and call the cvs import command,
which requires these args:

cvs import -m "Some Description" _src_dir_name_ _vendor_tag_ _release_tag_

    example> cd /usr/lib/perl5/site_perl/5.005/SampleProject
    example> cvs import -m "SampleProject site_perl" SampleProject ABCInc ver1

Getting removed files out of the Attic

Note: check the version of the file in the attic with 'cvs status'. Suppose the last version of the file was 1.3- that's the
empty version of the file, so you need to get out *1.2*.

  $ cvs update -p -r 1.2 file1 >file1
  ===================================================================
  Checking out file1
  RCS:  /tmp/cvs-sanity/cvsroot/first-dir/Attic/file1,v
  VERS: 1.2
  ***************
  $ cvs add file1
  cvs add: re-adding file file1 (in place of dead revision 1.3)
  cvs add: use 'cvs commit' to add this file permanently
  $ cvs commit -m test
  Checking in file1;
  /tmp/cvs-sanity/cvsroot/first-dir/file1,v  <--  file1
  new revision: 1.4; previous revision: 1.3
  done
  $ 

Getting More Info

The command 'cvs status' gives you information about what versions you have, what versions are in the repository, and who currently is
working on checked-out versions.

    example> cvs status              ## show status of everything
    example> cvs status bla          ## show status just for this file
    example> cvs status -l           ## show status just for files in this dir (not recursively)
    example> cvs status | grep Status | grep -v Up-to-   ## see what is Modified

To view the differnce between your version and the last commited version, or with yesterday's version:

    example> cvs diff bla
    example> cvs diff -D yesterday bla

Using CVS remotely

We allow entry only via ssh (no pserver)for security reasons. To do this on a linux machine, you should make
sure that you have added the snippet of bash code to your .bashrc mentioned earlier in this document
and use cvs as you would locally.

cvs (last edited 2008-07-14 09:55:46 by localhost)