An Intro to CVS for Astronomy
These are notes from a seminar on CVS I've taught
from time to time; comments and suggestions always welcome! Scroll
down to the bottom for useful CVS-related web links. (mperrin 2006-02-03)
What is CVS?
CVS is the Concurrent Versions System. It's a software tool for collaborative
version control of any sort of file, including source code, web pages, LaTeX
files, and more.
CVS keeps track of what changes are made in a file over time, allowing you
to switch back to earlier versions, coordinate changes with another person,
merge changes from different versions of the same file, and a lot more.
Why should I use CVS?
- For safety: You can revert to earlier versions of a file if you want,
avoiding all those stressful "but I swear this code worked last week! Why
is it crashing now?!?" moments.
- For collaboration: You can work on some project with a bunch of other
people, and it keeps track of everyone's changes. CVS is used widely in astronomical
software development (including MIRIAD and other RAL packages locally)
- For simplicity: You can synchronize files between many different
machines via CVS.
CVS Concepts
- a Module is a directory (and its contents and
subdirectories) that CVS is managing.
- Revision: A number defining a version of some file inside a
module.
- Tag:A string defining a version of some file inside
a module. Tags are just a symbolic stand-in for revision numbers.
- Branch: A version of the files in a module, distinct from
the main branch. (This is a semi-advanced concept and probably isn't
relevant for most astronomical projects!)
Basic Tasks
This is by no means meant to be an exhaustive guide! Try the tutorials under
the Links section for more detailed instructions.
Things we'll talk about during the seminar:
- specifying a repository: $CVSROOT or cvs -d
and $CVS_RSH for remote access.
- creating a repository: cvs init.
Don't forget about permissions!
- How to import
an existing directory or create
a directory from scratch
NOTE: There have been problems with cvs
import not working properly on Berkeley astro department
Suns. This seems to be an installation error of some kind. A
workaround is to run the cvs import command on a Linux box
instead; all other cvs commands seem to work fine on both Solaris
and Linux
- checking things out: cvs checkout [modulename]
- Getting updated files: cvs update
- commiting: cvs commit
- reverting cvs update -D [date] or cvs update -r
[revision number]
See also: date
formats
cvs update -A gets the most current
- fixing conflicts
- history and annotations cvs log, annotate
- branches: cvs tag -b, cvs update -r
- setting default options: the .cvsrc file
- ignoring some files: the .cvsignore file
Links
Official CVS Manual
("Cedarqvist"), and quick
reference
Introduction to CVS
(start here!)
Short Intro to
CVS
Learn
CVS in 2 (really 15) minutes
Open Source Development with CVS
CVS for BIMA
(lots of useful tips and links here!)
Maximizing
your Use of CVS, a very nice guide
Other Source Control Tools:
And related, but not really for source control:
This page last modified 2006-02-03 by Marshall