- 1 CVS Manual
- 1.1 Basic Usage
- 1.1.1 Connecting to a remote repository
- 1.1.2 Checkout project
- 1.1.3 Committing changes to a file in a checked out project
- 1.1.4 Add new file (or directory) to repository
- 1.1.5 Update your working copy of the repository
- 1.1.6 View log for a file
- 1.1.7 View differences between working copy and repository
- 1.1.8 View differences between 2 versions
- 1.1.9 Remove file from repository
- 1.1.10 Other Commands
- 1.1.11 Online CVS Manual
- 1.2 Administration and Advanced Usage
- 1.2.1 Setting up repository
- 1.2.2 Adding a User
- 1.2.3 Importing project
- 1.2.4 Overriding local CVS/Root
- 1.2.5 For multiple people working on same checked-out copy
- 1.2.6 Creating a private repository on buffy (cvs.biowiki.org)
- 1.1 Basic Usage
Connecting to a remote repository
Set these environment variables. For the bash shell:
export CVS_RSH=ssh export CVSROOT=:ext:user@serverName:/usr/local/cvs
You can override CVSROOT from the command-line using the -d option to cvs.
- cvs co path/to/project
- cvs co -r1.5 path/to/project/someFile
- Checkout version 1.5
Committing changes to a file in a checked out project
- cvs commit -m "Your comment" fileName
- use -l (local) to NOT recurse into subdirs; useful if you symlink to non-CVS subdirs
Add new file (or directory) to repository
- cvs add newFile
- cvs add -kb newBinaryFile
- -kb tells CVS that newBinaryFile is binary
- cvs add newDirectory
- Commit new file to repository. New directories do not need to be committed.
Update your working copy of the repository
- cvs update -Pd
- -d locally creates directories that were newly added to the repository
- -P to prune empty directories
- -A resets sticky tags, dates, or -k options (e.g. after doing 'cvs admin -kb')
View log for a file
- cvs log fileName
View differences between working copy and repository
- cvs diff fileName
- cvs diff -r1.7 fileName
- Compare with version 1.7
View differences between 2 versions
- cvs diff -r 1.1 -r 1.2 fileName
Remove file from repository
- First delete file.
- cvs remove fileName
- cvs commit -m "Your comment" fileName
A shorter way:
cvs rm -f fileName cvs co -m "comment" fileName
Restoring a deleted file
This is a bit non-intuitive: use cvs update instead of cvs checkout, then re-add the file back to the repository (the -p flag and I/O redirect are important to avoid sticky tag annoyances... trust me).
cvs up -p -r 1.1 deletedFile > deletedFile cvs add -kb deletedFile cvs ci
If this went correctly, the re-addition of the file will be appended to its original log... so when you do cvs log deletedFile, the revision history will show the file was deleted, then re-added again, which is nice for bookkeeping.
cvs admin -kb existingBinaryFile // tell CVS that existingBinaryFile should be marked as binary cvs status -v
Online CVS Manual
Administration and Advanced Usage
Setting up repository
ssh into CVS server addgroup cvsuser mkdir /usr/local/cvs chown root:cvsuser cvs cvs -d /usr/local/cvs init chmod g+w /usr/local/cvs
Adding a User
adduser user cvsuser // assign user to group 'cvsuser'
cd project cvs import -m "comment" path/to/project org_name release_tag # where 'path/to/project' is the location of 'project' within $CVSROOT # (replace 'path/to/project' with 'project' if you want it to land in the default location) # org_name and release_tag are e.g 'biowiki' and 'v1'
After importing the project, check it out.
Overriding local CVS/Root
You can override the local CVS/Root using the -d option:
cvs -d :ext:user@buffy:/usr/local/cvs <command>
For multiple people working on same checked-out copy
If you want multiple users to be able to update/commit/etc. a local copy, then don't specify the username when checking out the copy of the project, e.g.:
export CVSROOT=:ext:@buffy:/usr/local/cvs # do this before checking project out
cvs -d :ext:@buffy:/usr/local/cvs co <project>
Now the username of the person running "cvs up" or "cvs co" or whatever will be used to log into the remote CVS server.
For an already checked-out project, you can hack the CVS/Root file and remove the username to get the same result.
After initial check-out, you'll want to make sure for all files/dirs:
- chmod g+w
- chgrp holmeslab
otherwise you'll have permissions problems on "cvs up" when it tries to change stuff.
You'll probably want chmod the dir permissions to "a+s" so that any new project files/dirs added after "cvs up" automatically inherit the group ownership of its containing directory, i.e. "holmeslab" group - otherwise you might have permission issues with checking out new files. I'm not sure if "g+w" is inherited from containing dir or not when "+s" is set...
Creating a private repository on buffy (cvs.biowiki.org)
Let's say user john_b wants to set up a private CVS repository on buffy that can't be accessed by the public through ViewVC/ViewCVS ([]). There is probably a ViewVC config setting for this, but you can also do it the following way.
Basically, as long as your repository is outside of /usr/local/cvs/, it won't be visible on [].
There are two sub-cases:
1. The user wants the repository to be completely private
(i.e. no other people can see, checkout, or commit the project, even if they have user accounts on buffy)
It's done like this:
ssh firstname.lastname@example.org cd /home/john_b/ mkdir MY-CVS mkdir MY-CVS/CVSROOT chmod -R go-rwx MY-CVS exit
Now, on the remote machine, create and import the project like this:
mkdir fakeproject cd fakeproject touch fakefile.txt cvs -d :ext:email@example.com:/home/john_b/MY-CVS import -m "comment" fakeproject biowiki v1
Then of course you have to checkout the project to get yourself a local CVS-proper copy:
cvs -d :ext:firstname.lastname@example.org:/home/john_b/MY-CVS checkout fakeproject
2. The user wants other people in the lab to access the repository
(i.e. only people with user accounts on buffy can see, checkout, and commit the project)
Do the stuff above in Case 1, except also:
ssh email@example.com cd /home/john_b/ chmod -R g+rws MY-CVS chgrp -R cvsuser MY-CVS
Everyone who has a user account on buffy can now work on the project.
-- Yuri Bendana - 22 Apr 2006