CVS

From COSSAN Wiki
Jump to: navigation, search


CVS for COSSAN

Please don´t use the account cossan to commit your file but always use your own account!

In the following useraccount means your own account (e.g. Pellissetti has to use mfp).

QUICK'n'DIRTY IMPORTING NEW MATERIAL TO COSSAN REPOSITORY (MFP)

  • export CVSROOT=:ext:useraccount@c810-s1:/home/cossan/COSSAN_CVS
  • go to dir containing the files and/or subdirectories you want to import
  • cvs import -d "Projectname" vendor initial (note: Projectname need not to be the name of the current directory) (note 2: this will create the directory /home/cossan/COSSAN_CVS/Projectname on c810-s1, e.g. /home/cossan/COSSAN_CVS/COSSAN-Parallel)
  • checkout a new sandbox (and then erase the original directory on your local machine); that way the dir CVS will be installed and CVSROOT env variable not needed any more: cvs co -P Projectname

QUICK'n'DIRTY CHECK-OUT FROM COSSAN REPOSITORY (MFP)

  • create a folder /matlab/toolboxes/ on your home and go there for performing the steps as indicated on the example
  • export CVSROOT=:ext:useraccount@c810-s1:/home/cossan/COSSAN_CVS
  • checkout a new sandbox: cvs co -P Projectname (e.g. Projectname=COSSAN-X)

Example:

  • be sure that cvs is installed on your machine:
sudo yum install cvs
export CVS_RSH=ssh
export CVSROOT=:ext:useraccount@c810-s1:/home/cossan/COSSAN_CVS
cvs checkout COSSAN-X


QUICK'n'DIRTY UPDATE OF YOUR ENTIRE COSSAN-X SANDBOX (MFP)

  • go to the directory which contains the COSSAN-X directory (e.g. to /home/mfp/matlab/toolbox)
  • 'export CVSROOT=:ext:useraccount@c810-s1:/home/cossan/COSSAN_CVS'
  • 'cvs co COSSAN-X'

Headline text

IMPORTANT TIPS

- Always check the status of your files before committing them to repository ( So that you will know if there are any conflicts or not)

- Update your files before doing the modifications, in that way you will obtain the latest versions of the files and decrease the chance of any conflict to occur

- A conflict will take place when two users do some changes on a file simultaneously. In that case the programmer that will commit first will not have any problem and will be able to commit the new version to the repository. But the second programmer will see the cvs status as "needs merge" for that file since the file in the repository is not the same anymore as he previously checked out.

What is to do?

=> In that case the second programmer has to do first an update to see the differences between his file and the file in the repository.

After the cvs update the local version will contain both versions of the differences. One then must hand-edit the file, looking for sections like the following:

       <<<<<<< filename
       ... lines from local version
       =======
       ... lines from latest repository version X.Y
       >>>>>>> X.Y
       

Once you eliminate these lines (after discussing it with other programmers since you will be overwriting the modifications they have done), if you check the cvs status again, you will see that it is changed to "locally modified". Then you can submit your version to the repository.


- If you created a new file in your sandbox (lets say you developed an extra function "model.m" which was not in the repository before) use the command:

 cvs add model.m

The file will be scheduled to be added in your next commit command

The other users will get this new file when they perform "update" command


- If you think that a file is not needed anymore (lets say you want to remove density.m function) first delete the file from your sandbox and then use the command

 cvs rm density.m

The file will be scheduled to be deleted in your next commit command

To remove a directory from repository, you have to delete it from the original repository!!

The other users will see "entry invalid" status for that file until they perform "update". Then the file will be also removed from their sandbox.

- It is also possible to just checkout a subdirectory of a whole project. For example, the command:

cvs co COSSAN-X/@rv

will only checkout @rv directory of COSSAN-X


A few useful CVS commands:

  • cvs checkout filename.m (checkout the file filename.m from the repository)
  • cvs update filename.m (get the latest version)
  • cvs add filename.m (add the file to the repository)
  • cvs commit filename.m (commit changes to the file to the repository)
  • cvs log filename.m (see a log and a list of the revisions)
  • cvs diff -r r1 -r r2 filename.m (see the differences between revision r1 and r2 of filename.m, e.g. 1.2 and 1.3)

USEFUL LINKS

See Also