TDDB69 > CVS
Hide menu

TDDB69 Advanced Web Programming

CVS


This is a brief introduction on how access CVS repository

Very short CVS introduction

Working with CVS at IDA

This is a short introduction on getting started on working with cvs at ida. For a more comprehensive manual on CVS look at  https://www.cvshome.org/docs/manual/.

Setting up a Repository

In order to start using cvs you need to set up a repository where all you work will be stored. This is done by creating a new catalog in your home directory.
 For example: mkdir cvsroot
 Next step is to initialize  the repository this is done by using
 cvs -d /home/your_user_name/cvsroot  init

Setting up file permissions

In order to allow your project members to work with the same repository you need to set up some file permissions.  This is  easiest  done with  the setfacl command.  You need to issue the following command for each member of your project.
setfacl -mmask:7,user:username:--x /home/your_user_name/
setfacl -mmask:7,user:username:rwx /home/your_user_name/cvsroot
setfacl -mmask:7,user:username:rwx /home/your_user_name/cvsroot/CVSROOT
setfacl -mmask:7,user:username:rwx /home/your_user_name/cvsroot/CVSROOT/*

For example allowing user eribe to access user andla895 cvs repository:
setfacl -mmask:7,user:eribe:x /home/andla895/
setfacl -mmask:7,user:eribe:rwx /home/andla895/cvsroot
setfacl -mmask:7,user:eribe:rwx /home/andla895/cvsroot/CVSROOT
setfacl -mmask:7,user:eribe:rwx /home/andla895/cvsroot/CVSROOT/*

Starting the project

Now that the repository is set up you can start your cvs project.  This is done by using the cvs import command
For example:
cvs -d /home/andla895/cvsroot/  import projectName andla895 start

The cvs import command is recursive and will enter all sub directorys and add all files in them as well so be careful from which directory you issue the command. If your project don't have any files yet , create an empty directory and issue the command from there. If you already have a few files, enter the directory where you have your files and issue the command from there. If you added some files with import  you need to check out them before you can start working with them. 

Working with the Repository

To start working with the project you first need to check out the project from the repository, this is only needed the first time.
This is done by using the cvs co command.
Example:
cvs -d /home/andla/cvsroot/ co projectName

To retrieve the latest version of your projects use the cvs update command.

Adding files the the repository use cvs add files and then use the cvs commit  command
Example:
cvs add Start.java  DataBase.java
cvs commit

Accessing the Repository from home

Cvs allows you to access a repository from a remote machine over ssh.  In order to tell cvs to use ssh to access remote repositories you need the set the CVS_RSH variable to ssh.
Example: setenv CVS_RSH ssh
or in bash: export CVS_RSH=ssh
You also need to tell cvs that the repository is located on remote machine, this is done by using the
cvs -d :ext:username@remote.machine:/path/to/cvsroot/  co projectName
Example:
cvs -d :ext:andla895@astmatix.ida.liu.se:/home/andla895/cvsroot co myProject
 
If you don't want to use the -d flag each time you can set the CVSROOT variable instead
setenv CVSROOT :ext:andla895@astmatix.ida.liu.se:/home/andla/cvsroot
in bash use
export CVSROOT=:ext:andla895@astmatix.ida.liu.se:/home/andla/cvsroot





A simple example (not including file permissions for other members)

su10-3> setenv CVSROOT /home/andla895/cvsroot

su10-3>mkdir TDDB69

su10-3>cd TDDB69

su10-3>cvs import webProject andla895 start

Log message unchanged or not specified

a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs Action: (continue)

No conflicts created by this import

su10-3>cvs co webProject

cvs checkout: Updating webProject

su10-3>cd webProject

su10-3> emacs Main.java

su10-3>cvs add Main.java

cvs add: scheduling file `Main.java' for addition

cvs add: use 'cvs commit' to add this file permanently

su10-3>cvs commit

cvs commit: Examining .

cvs commit: Committing .

Log message unchanged or not specified

a)bort, c)ontinue, e)dit, !)reuse this message unchanged for remaining dirs

Action: (continue)

RCS file: /home/andla/cvsroot/webProject/Main.java,v

done Checking in Main.java; /home/andla/cvsroot/webProject/Main.java,v <-- Main.java initial revision: 1.1

done

su10-3>cvs update

cvs update: Updating .



Page responsible: Erik Berglund
Last updated: 2005-04-22