A CVS Tutorial for NuTeV
This is a step-by-step set of instructions on how to use CVS,
written for the users on experiment E815. The first list explains how
to get the source code for a product and use it for your own
applications.
The basics of getting a new product is fairly easy. Most (but
not neccessarily all) products are designed with a Makefile so that you
can create a default executable and start running immediately.
1. (Optional) > mkdir productdir
2. (Optional) > cd productdir
3. > cvs checkout productname
4. > cd productname
5. > make
You should always check the README document, if there is one, or
consult other sources. See the list of
Software Available in CVS for product names and links to WWW
documentation.
- 1-2 (Optional): Creating a product directory.
- CVS will make its own directory for the source code it takes
from the repository. However, if you are going to be significantly
customizing or adding to the code, it is helpful to have a personal
area separate from the ``pure'' product code.
- 3: Checking out the product.
- This creates a new subdirectory of the current directory, with a
directory name the same as the name of the product.
- 4-5: Making the executable.
- Several products have a default Makefile which lets you create an
executable quickly. You should check for the specifics, however.
For more details on this, see the section on
cvs checkout in the full
documentation.
In order to get all the updates which have been made to the
product, simply go into the productname directory and say:
1. > cvs update -d
CVS will automatically merge the changes made
to the repository and the changes which you have made. It will keep what
changes you have made, and overlay the changes which have been made to the
repository. This is indicated by the output which the cvs update
command produces, which looks something like:
U afile.F
M changedfile.F
U driver.F
A newfile.F
? userfile.f
The single-letter code on the left indicates what has happened
to that file. The only code which you have to worry
about would be a `C' - which would indicate that your
changes and the repository changes conflict. This means that
you have to go into that file, and edit it to be the version which you
want. Within the file, you will find something like:
>>>>>>>>>>>>>>>>>>>
avar = value1
>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<
avar = value2
<<<<<<<<<<<<<<<<<<<
The first code is the repository change, the second is the change
which you made. You have to delete the version you don't want, and
remove all the >'s and <'s.
The other codes mean the following:
- U :
the file was updated to match the repository
- M :
your changes were merged with changes in the repository
- A :
the file was recently added to the repository
- ? :
the file was unrecognized and ignored - it is not in the repository
For more details on this, see the section on
cvs add in the full documentation.
The most important thing to remember in committing is to be
careful. Test the code exactly as it will appear in the
repository (i.e. no user-only routines or changes). You should inform
whoever is in charge of that code what you are going to do. Assuming
he or she approves, then the steps are as follows:
- > setenv EDITOR yourfavorite
- This line should probably be added to your
.login file.
- (Optional) > cvs add newfilename
- If you are adding a new file or directory to the repository, you must
specify it in advance of committing. Otherwise CVS will just ignore it.
- > cvs commit filename
- This commits the changes you have made to file filename to
the central repository. If you leave filename blank, it will
commit all the changes you have made to the code.
Upon the commit command, CVS will demand from you a
comment for the record on the changes which you have done (using the
editor defined in the first step). For most significant changes, you
should also send a note to the NuTeV Bank System.
For more details on this, see the section on
cvs commit in the full documentation.