Cvs Manual

From Biowiki
Jump to: navigation, search

---

CVS Manual

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.

Checkout project

  • 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.

This advice is from: http://cvsbook.red-bean.com/cvsbook.html#What%20Happens%20When%20You%20Remove%20A%20File

Other Commands

	cvs admin -kb existingBinaryFile // tell CVS that existingBinaryFile should be marked as binary
	cvs status -v

Online CVS Manual

Go here.

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

    id user
    adduser user cvsuser // assign user to group 'cvsuser'

Importing project

	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

or

	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 ([[1]]). 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 [[2]].

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 john_b@cvs.biowiki.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:john_b@cvs.biowiki.org:/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:john_b@cvs.biowiki.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 john_b@cvs.biowiki.org
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