CEPA Home

CVS Primer

The complete cvs document

First time setup:

 mkdir $HOME/cvs
 setenv CVSROOT $HOME/cvs
 setup cvs
 cvs init 		-  creates the necessary administration files

Chosing your editor:

 cvs commit defaults to using the vi editor for your comments
 to choose another editor, set either $CVSEDITOR or $EDITOR
 $CVSEDITOR takes precedence over $EDITOR
 e.g. setenv CVSEDITOR emacs

Add directory tree:

 cd somelibrary/v1.1
 cvs import -m "sources for the somelibrary library" somelibrary bphys v1_1
 cd ../work
 cvs co modules
 cd modules
 ( edit modules, adding the line "somelibrary   somelibrary" )
 cvs commit -m "added somelibrary" modules
 cd ..
 cvs release -d modules (release and delete working cvs directory)

Importing major updates:

	If you are not making incremental changes, but just installing
	a new release of a library, then you should use the import 
	command again.  Import ignores files like *.a and *.o, but
	you should always import from a clean, working directory.

	cvs import -m "somelibrary 1.2" somelibrary bphys v1_2

Library releases:

	make library release versions with cvs tag and cvs rtag
	tags cannot include ".", so v1.1 is tagged as v1_1

	cvs rtag v1_3 somelibrary 
		Tags the latest version of all files in the cvs repository
		for somelibrary as release v1_3.

Checkout a library:

	use this if you want to make changes in the library files

	cvs co somelibrary
	cvs co -r v3_0 somelibrary

Extract a library:

	use this if you just want to get the code, but not make changes
	The export command forces you to specify a tag.

	Alternatively, use "cvs co" followed by "cvs release".

	cvs export -r v3_0 somelibrary
		creates directory tree somelibrary
	cvs export -r v3_0 -d v3_0 somelibrary
		creates directory tree v3_0

Incremental updates:

	Use the commit command to make incremental updates.
	Unless you create a branch, you cannot modify any code
	associated with a tag.

	cvs commit somelibrary
		will search for changes and only install the changed code

Adding files:

	Files must be explicitly added to cvs libraries

	cvs add filename
	cvs commit filename (to make the addition permanent)

Recovering an old revision of a file:

	First determine the revision you want.
	cvs log filename 

        You must remove or rename the file.
	rm filename
	cvs update -r x.y filename

Removing files:

	This is not to be done lightly.

	rm filename
	cvs remove filename
	cvs commit filename (to make the removal permanent)

Creating a branch:

	cvs rtag -b -r v2_0_0 v2_0_0_patch mcfast

Working with a branch:

	cvs co -r v2_2_0_patch mcfast
	make modifications
	cvs commit	(automatically commits changes to this branch)

Merging a branch with the main development line:

	cvs co mcfast
	cd mcfast
	cvs update -j v2_5_1
		Mcfast will now be nearly a carbon copy of branch v2_5_1.
		Files which were modified are saved as .#file.version.
		You will need to go through each of the modified files
		by hand to verify changes.
		Files which exist on the branch will be added to dev.
	cvs commit 	(do this only after verifying the changes)

To move a tag:

	cvs tag -F v3_0 filename
		This should be done very carefully, probably on a 
		file-by-file basis.

Logging changes:

	Add the following lines to the bottom of fortran files:
		c $Id: cvs_primer.shtml,v 1.2 2003/09/10 21:22:48 garren Exp $
		c $Log: cvs_primer.shtml,v $
		c Revision 1.2  2003/09/10 21:22:48  garren
		c *** empty log message ***
		c
		c Revision 1.1  2003/09/10 21:09:14  garren
		c simulation page
		c
	Add the following lines to the bottom of c files:
		/* $Id: cvs_primer.shtml,v 1.2 2003/09/10 21:22:48 garren Exp $
		   $Log: cvs_primer.shtml,v $
		   Revision 1.2  2003/09/10 21:22:48  garren
		   *** empty log message ***
		
		   Revision 1.1  2003/09/10 21:09:14  garren
		   simulation page
		
		*/
	Add the following lines to the bottom of c++ files:
		// $Id: cvs_primer.shtml,v 1.2 2003/09/10 21:22:48 garren Exp $
		// $Log: cvs_primer.shtml,v $
		// Revision 1.2  2003/09/10 21:22:48  garren
		// *** empty log message ***
		//
		// Revision 1.1  2003/09/10 21:09:14  garren
		// simulation page
		//

Currently cvs recognizes the following default extensions:

	Fortran: .f .for
	C:       .c .h
	C++:     .c++ .cc .cpp .cxx .hpp .hxx .hh
	
	You can tell cvs to recognize other extensions with the cvs admin
	command (e.g. cvs admin -c"c " *.inc).  You must execute this
	command in the appropriate cvs subdirectory.


Fermilab at Work ]  [ Computing Division ]  [ CEPA ] [ APS ] [ ESE ]  [ OAA ] [ PSM ]
Lynn Garren
This file last modified Wednesday, 10-Sep-2003 16:22:48 CDT
Security, Privacy, Legal Fermi National Accelerator Laboratory