- 1 Quick CVS Introduction
- 2 Repository Access Methods
- 3 Repository Permissions
- 4 Collaborating with People Outside the Department
- 5 CVS Reference
Quick CVS Introduction
Creating a Repository
You can create a cvs repository in your home directory:
cvs -d ~/cvsroot init
You will probabably want to modify your .profile file to contain the cvsroot and cvseditor variables.
export CVSROOT=$HOME/cvsroot export CVSEDITOR=vi
Importing a Project
When you import a directory into your cvs repository, it becomes a module. Assume that you would like to import directory ~/project1 into your repository created above.
cd ~/project1 cvs import -d ~/cvsroot myproject yourname start
This tells cvs to store your project1 directory in the repository under the name myproject. When you checkout myproject later, it will create a myproject folder. 'yourname' and 'start' are unimportant - they are vendor and version labels, respectively.
Checkout a Project
When you checkout a project, you tell cvs to create a working copy.
cd ~ cvs checkout myproject
The directory myproject now exists in your home directory. It should have a subdirectory called CVS.
The update command updates your working directory from the repository and tells you the status of your files. (M=modified, p=patched from other updates in the repository, U=a new file that wasn't previously in the working directory)
cd ~/myproject cvs update
You can use the difference command to see what has changed in the files marked 'modified.'
cvs diff example.txt
To commit files back to your repository, use the commit command.
cvs commit example.txt
CVS will then bring up an editor (the one specified in your CVSEDITOR variable, or emacs by default) where you can enter a log message, detailing what you have changed. To avoid having the editor opened, a log message can be included in the commit command.
cvs commit -m "added a cool new function" example.txt
Repository Access Methods
A repository might be on your local computer, a computer across the room or even a computer across the world. Thus, there are different methods to access a repository.
Use :local: to access a repository directory. For instance, :local:/cvsroot indicates that the repository is located in /cvsroot on the computer running CVS. If you don't specify an access method when connecting to a repository, local is assumed.
Your working copy of the sources can be on a different computer than the repository. Using CVS in this manner is known as a client / server operation. You run cvs on a machine which can mount your working directory, known as the client, and tell it to communicate to a machine which can mount the repository, known as the server. Generally, using a remote repository is just like using a local one, except that the format of the repository name is:
Specifying a password in the repository name is not recommended during checkout as this will cause cvs to store a cleartext copy of the password in each created directory. Use 'cvs login' first instead.
To connect to a repository via a password authenticating server, you specify the pserver protocol.
cvs -d :pserver:computername.cs.virginia.edu:/path/to/repository checkout someproject
Ssh can be used to access a CVS repository remotely. To do this, you first need to set the CVS_RSH variable. This can be done on the command line or in your .profile.
Example: You want to checkout the cvs module 'someproject' in the repository '/cvsroot/' on machine luray.cs.virginia.edu.
cvs -d :ext:email@example.com/cvsroot checkout someproject
The username can be omitted if it is identical on both (local and remote) hosts.
Any repository that you create will be owned by your and your [default] group. Only members of your group will be able to access your repository. For instance, if you are a member of csfaculty and create a repository, a student belonging to csgrads would not have the permissions to access your repository.
CVS only allows files to be controlled on a per directory basis, not on an individual one.
Possible solutions include:
- Setting up a unix group containing the people who should be able to access the repository, and then ensure that the repository directory is owned by that group.
- Hosting your repository remotely on the pserver and setting up accounts for those who need access
Email root to help set you up.
Collaborating with People Outside the Department
If you want people outside the department to have access to your repository, then you will need to host it remotely on the pserver.
- The CVS manual can be found at: http://ftp.gnu.org/non-gnu/cvs/source/stable/1.11.22/cederqvist-1.11.22.pdf