- The Basics.
See a good short introduction to version control and CVS on the CVS site: http://www.cvshome.org/docs/blandy.html.
Fairly comprehensive and to-the-point CVS online help is available from the department.
- Setting your repository.
You need an environment variable CVSROOT that is
set to "/u/ml/groupcode/cvsroot". Add a corresponding statement to your .bashrc
(.cshrc, .tcshrc) script:
csh or tcsh:
setenv CVSROOT=/u/ml/groupcode/cvsroot # csh, tcsh
- Checking out a project into a working directory.
Suppose you would like to work on project "weka" in your local directory
/u/someuser/work/weka. You would then execute:
cvs checkout weka (or, equivalently, cvs co weka)
This will create the
weka directory in /u/someuser/work and copy all source files from the repository into this directory.
- Editing a file and checking it back into the repository.
After you have
made changes (e.g. to classes File1.java and File2.java), and made sure other classes
that may be affected by your changes are not broken, commit your changes by
executing the following command in the directory where the files are located:
cvs commit file1.java file2.java (or, equivalently, cvs ci file1.java
An editor window will come up for entering a comment describing the changes (you can
change the editor from the default vi by setting a CVSEDITOR environment variable).
When you exit the editor, the files will be checked in.
If you use Emacs, simply press Ctrl-X Ctrl-Q (or Ctrl-X v v) when you are
in the file's buffer to commit it. A comment window will open as another Emacs buffer, and
pressing Ctrl-C Ctrl-C after entering the comment completes the checkin.
Emacs Tools->Version Control pull-down menu contains a number of other useful
commands besides Check In (Commit), such as version history etc.
- Updating the working directory, or seeing which files you have modified
It is a good idea to check whether the file that you are about to start editing has
been recently modified by somebody else. Execute the following command in your working directory:
Output will list files which are either not present in the repository (marked by
"?"), or have been updated for you (marked by "U"), or have been modified by you but
have not been checked in (marked by "M"). Files marked by "I" are ignored by CVS -
usually these are non-source code files.
- Adding new files or directories to the repository
and removing section of CVS Help for command-line procedures.
In Emacs, pressing "Ctrl-X v i" registers a new file in the repository in a location
corresponding to its location in the working directory. The file
still needs to be committed (Ctrl-X Ctrl-Q) for the addition process to complete.
- Undoing your checkin (reverting), going back to older versions, etc.
In Emacs, Tools->Version Control gives a number of different commands (revert to last
version, undo last checkin, show version history, compare versions, etc.).
From a command line, various update options allow these tasks, see help