Fast & Security Conscious
High-Availability Unix Hosting
CVS micro-howto

This micro-howto will canvas, in a very short fashion, the necessary commands and configuration details involved in accessing CVS accounts hosted on servers at Csoft.net.

NOTE: This guide is under construction.

Initializing the account

After obtaining your CVS account(s), either via csoftadm or tech support, imitate the following commands in the examples given below by making the necessary substitutions.

Assume for the sake of explanation -

  • The CVS user = mycvsuser
  • The server = myhost.csoft.net
  • The main user = myname
  • The CVS repository = /home/myname/cvs

Declare the following two environment variables on your workstation -

  Bourne shell:
    $ export CVSROOT=mycvsuser@myhost.csoft.net:/home/myname/cvs
    $ export CVS_RSH=ssh
  C shell:
    % setenv CVSROOT mycvsuser@myhost.csoft.net:/home/myname/cvs
    % setenv CVS_RSH ssh

Note that the CVSROOT is recorded with your working copy, so you only need to specify it once.

Before cvs commands can be issued, the repository must be initialized. To initialize a repository, execute -

  $ cvs -d $CVSROOT init

Creating a directory and adding/removing files

To create a directory, html on the server and add a file, new.html to the repository, execute -

  $ cd ~/
  $ mkdir html
  $ cp new.html html
  $ cd html
  $ cvs import -m "My website" html mycvsuser start

The above commands will create a directory html in and generate a cvs version of the file new.html to /home/myname/cvs. The exact value of the vendor-tag (here "mycvsuser") and release-tag (here "start") parameters are not all that important for most purposes.

Alternatively, the above importation could have been achieved by the import command.

To confim the existence of the directory and file in the repository, download them, after wiping out your local copy of the html directory -

  $ cd ~/
  $ rm -rf html
  $ cvs checkout html

Removing a file from the repository is performed by the remove command. The elimination of the file from the repository does not become permanent, until the commit command is invoked. Removing directory contents recursively is achieved with the -R flag. For example, to remove new.html -

  $ cd ~/html
  $ cvs remove -f new.html
  $ cvs commit new.html

Miscellaneous

Transfering a binary type file to the server requires some consideration to prevent RCS tag substitution. The most practical method is to append the -kb switch to the add command. Suppose you wish to convey the image.jpg image on the local computer to the html directory on the repository, use this set of commands -

  $ cd ~/html
  $ cvs add -kb image.jpg
  $ cvs commit image.jpg

Differences between revisions of text files can be reviewed using the diff command -

  $ cvs diff foo.txt
  $ cvs diff -r1.2 -r1.3 foo.txt

Revision history of files can be reviewed using the log command -

  $ cvs log foo.txt

Default flags for cvs commands can be specified in the ~/.cvsrc file. For example -

  # Use compression level 3
  cvs -z3
  # Create directories and prune empty directories.
  update -dP
  # Prune empty directories.
  checkout -P
  # Produce unified diffs, include newly added/removed files.
  diff -uN

Troubleshooting

If the error "can't getwd" appears when attempting to commit or even checkout data, check that the CVS account you are using has the permissions +x (and possibly +r, depending on your server OS) on all parent directories relative to the repository.

  $ ls -ld $HOME
  $ ls -ld $HOME/my-repo/
  $ chgrp my_cvs_users $HOME/my-repo
  $ chmod g+rwx $HOME/my-repo

More information

At least, to have an outside shot at operating cvs semi-competently, peruse the FAQ.

Some helpful links:


  End Software Patents!