CVS
- Concurrent Versions System
- GPL
- Part of Source Configuration Management (SCM)
- Similar to RCS, PRCS, and Aegis
- Bookkeeping subdirectory: CVS for each directory
- Useful for tracking the file history
- Every developer works in their own directory; CVS merges the work when each developer is done.
- Stores only the difference between versions of a file
- CVS does not keep a record of groups of files that were changed together (though the log message for each would be the same)
- All files are stored in a central repository
- There is no need to lock files before editing them
- Repository: The master set of files (as opposed to a local copy of the files); $CVSROOT is the location of the repository
- Module: A project, a related set of files within a repository; defined in the 'modules' file
- CVS --help-options
- CVS --help-commands
- CVS --help <command>
Editing files
Checkout a file
cvs [-P] [-d <cvsroot-path>] <checkout|co> <cvs-dir>
- Check out all files in <cvs-dir> to the current directory (recursively)
- The
-Poption prunes empty directories. - When a directory is checked out from a repository, it will be created on the local drive at the current or specified location and does not have to exist ahead of time.
cd /home/myname cvs -d :pserver:anonymous@cvs.sv.gnu.org:/sources/emacs checkout . # all modules cvs -d :pserver:anonymous@cvs.sv.gnu.org:/sources/emacs checkout emacs # emacs module # Destination: /home/myname/emacs
cd /home/myname cvs -d :pserver:anonymous@cvs.sv.gnu.org:/sources/emacs co emacs/lisp # emacs/lisp module # Destination: /home/myname/emacs/lisp
Export a file
- Get an unversioned copy of the file (no .svn subdirectories)
cvs [-d <cvsroot-path>] <export> -DNOW <cvs-dir>
- The -DNOW option gets the latest version of the files.
- When a directory is exported out from a repository, it will be created on the local drive at the current or specified location and does not have to exist ahead of time.
cd /home/myname cvs -d :pserver:anonymous@cvs.sv.gnu.org:/sources/emacs export -DNOW emacs/lisp # Destination: /home/myname/emacs/lisp
Identify which working files have changed
cd <working-dir> cvs status [<file>]
Show all changes to working files
cd <working-dir> cvs diff <file>
- See how a working file has changed since it was checked out
cvs diff -r <tag> <files> # Compare specified revision against working copy cvs diff -r <tag> -r <tag> <files> # Compare specified revision against another revision
Check-in a file
cd <working-dir> cvs <commit|ci> [-m "log message"] <file>
Update the working files
cd <working-dir> cvs update [<file>]
Indicate that a set of files are no longer in use
cvs release [-d] <cvs-dir>
-d: delete the working copies
Release messages
- ? <file> # The file is not in CVS (common message for generated files)
- M <file> # The file has been changed since it was checked out
Adding tags
CVS tag -[dF] <tag> [-r <tag>] <files>
-d Delete the specifed tag
-F Move tag if it already exists
-l Local (non-recursive)
-R Recursive
Modifying the repository
Add a directory
cvs add <cvs-dir>
Add a file
cvs add <file> cvs <commit|ci> [-m "log message"] <file>
Remove a file
cvs remove [-f] <file> cvs <commit|ci> [-m "log message"] <file>
- Use of the
-foption forcvs removeautomatically deletes the working copy of the file.
Remove a directory
- There's no way to remove a directory in CVS.
- Use the
-Poption when checking out files, to avoid creating empty working directories.
Rename a file
mv <old> <new> cvs remove <old> cvs add <new> cvs <commit|ci> -m "Renamed <old> to <new>" <old> <new>
Administrative commands
Create a repository
cvs [-d <cvsroot-path>] init
- To avoid having to use the "-d <cvsroot-path>" option, add the following line to .profile or .bashrc
- init doesn't overwrite any existing files
export CVSROOT=<cvsroot-path>
Import a project into CVS
# Import the project in the current directory into <cvs-dir> (recursively). cvs import -m "Imported sources" <cvs-dir> <vendor-tag> <release-tag>
Terms
Repository
- The master set of files (as opposed to a working copy of the files)
- $CVSROOT is the location of the central repository
Module
- A project, a related set of files within a repository
- Defined in the 'modules' file
Files
Repository
- $CVSROOT/CVSROOT # Administrative files
- $CVSROOT/gnu # Utilities
- $CVSROOT/<module>
- $CVSROOT/<module>/*,v # History files
Resources
Sources
- http://ximbiot.com/cvs/manual/
Parent URL:
category/data