gBAR
Student IT support moved to the DTU Library. Latex support remains in 125D/308

CVS (Concurrent Versions System) is a system for keeping track of project files with several people working on them. Project files are stored in a CVS repository along with information about the changes made to the files. Old versions of the files are saved, which makes them easy to recover. The files are grouped into modules, which you can create with the import command.

When you want to work on a file, you download (check out) a local copy of the file. When you finish working on the file, which is actually the copy in your home directory, you upload the file and the changes by committing the file back to the repository. If the file has been changed since you checked out your copy, you are not allowed to commit the file. Instead, you can view the differences between your version and the new version of the file by using the command update.

Note

Starting January 1st, 2007, a new CVS-server (repos.gbar.dtu.dk) is available.

The most important features of the new CVS-server are:

  • You can create more than one repository, each with its own set of users (e.g. one repository per course).
  • It is now easier to give access to other users.
  • Simplified way of making backups of your repositories.

As mentioned, the new server is available at repos.gbar.dtu.dk.


CVS in the G-Bar

As a user in the G-Bar, you have the opportunity to create a repository. Use the interface located at repos.gbar.dtu.dk to create the account; usage of the interface is described there as well. When the repository has been created, you may either continue to work with the options provided by the CVS interface, or set it up from the command line (described in the section "CVS from the command line"). Remember to take note of the $CVSROOT (checkout string) information, which is listed when you've created the repository. The information about the server that it contains is needed to access the CVS later.


Access your CVS

You have a few options when you want to use the newly created CVS for daily use. The G-Bar provides a graphical tool to work with the CVS (i.e. checkout, commit and update), which is called smartCVS. smartCVS may be started from the menu under the category options, or alternatively from the command line with the command "smartCVS". Should you prefer a text based approach, you may use the traditional CVS commands from the command line, in which case you should read the "CVS from the command line" section.

Using smartCVS

We're not going to cover the full usage of smartCVS here, as it is a fairly straight forward program to use if you understand CVS (and if you don't, you might want to use Google to read up a bit first :-). One part of the program is especially relevant though, and that is the Repository Profiles, one of which you need to create to be able to access your new CVS repository. Project -> Repository Profiles -> add -> enter CVS location contains a textbox, where you should fill in the $CVSROOT information that you took note of earlier (it has the following syntax):

:pserver:USERNAME@cvs.gbar.dtu.dk:/home/cvs/LOGIN/REPOSITORY

If you copy-paste the info into the pserver field, smartCVS will fill out all relevant info for you. Beyond this, default settings should typically be adequate to configure smartCVS for daily use.


CVS from the command line

Set up $CVSROOT

The CVSROOT variable defines a path to your CVS repository so the CVS client knows where to look. Most commonly a CVSROOT is remote and will be in the following form:

[:method:][[user][:password]@]hostname[:[port]]/path/to/repository

If you have a CVS account in the G-Bar, you should set your CVSROOT in one of the following ways, depending on your shell (BASH is standard in the G-Bar):

export CVSROOT=:pserver:USERNAME@cvs.gbar.dtu.dk:/home/cvs/LOGIN/REPOSITORY

tcsh:

setenv CVSROOT :pserver:USERNAME@cvs.gbar.dtu.dk:/home/cvs/LOGIN/REPOSITORY

If it is your own CVS-repository, LOGIN will be the same as USERNAME.

You are now asked for a password. This is your standard databar password, if it is your own repository. If not, the password will be the password chosen by the owner of the repository when they added you to the repository. For adding users to a CVS-repository see the description below.

You have to run

CVS login

before you can access the CVS-server.

Your CVS-password will be stored (encrypted) in ~/.cvspass so that you do not need to run that command every time you want to use CVS. If you prefer not to have your password stored in that file, run "cvs logout" after you finish using CVS.

Note: For all of the following commands to work, CVS has to "know" your CVSROOT. Normally CVS will already know this since it is stored in directory/CVS/Root, which is created by CVS when you check out a module. However, if you are using CVS for the first time or adding a new module, you must setup your CVSROOT yourself as mentioned above.

Add users to a CVS-repository

You can add users to your CVS-repository in two ways: either by using the admin page on the CVS-server or by following this guide.

First run the following command to check out the password file for the CVS-repository:

cvs checkout CVSROOT/passwd

Add one or more users to the password file. In this example, we add the user s801234 to the password file:

htpasswd CVSROOT/passwd s801234

Start your favorite text editor and make sure that all lines in CVSROOT/passwd end with ":cvs", just like the first line with your own encrypted password.

Next you have to update the password file on the CVS-server. This is done using the normal CVS commit-command:

cvs commit CVSROOT/passwd

Since you no longer need a local copy of the password file, you can remove it using:

cvs release -d CVSROOT

Type "yes" to delete the local files.

The $CVSROOT of s801234 should be:

:pserver:s801234@cvs.gbar.dtu.dk:/home/cvs/LOGIN/REPOSITORY

(where LOGIN most likely is your login)

Add a read-only account to a CVS-repository

Just like normal read/write accounts, a read-only account can be added in two ways: either by using the admin page on the CVS-server or by following this guide.

First check out the password file:

cvs checkout CVSROOT/passwd

Add the following line to CVSROOT/passwd using your favorite texteditor:

anonymous::cvs

and add this line to CVSROOT/readers:

anonymous

If you don't want to, you don't need to name the read-only account "anonymous", although it is a standard name for a read-only account. To change the account name, simply change "anonymous" to something else in both files (and in the $CVSROOT, which we will mention later).

Tell CVS to upload CVSROOT/readers to the CVS-server:

cd CVSROOT ; cvs add readers ; cd ..

Now, command a commit to upload the files:

cvs commit CVSROOT/passwd CVSROOT/readers

You can remove the local copies of "passwd" and "readers" using

cvs release -d CVSROOT

Type "yes" to delete the local files.

The $CVSROOT for the read-only account is:

:pserver:anonymous@cvs.gbar.dtu.dk:/home/cvs/LOGIN/REPOSITORY

(where LOGIN most likely is your login)


 Basic CVS usage

Create a new CVS module

To create a new CVS module, you can use the CVS import command, which uses the following parameters:

cvs import [-options] repository vendortag releasetag


The easiest way to learn how to create a new CVS module, is by looking at an example:

  • First go to the directory you want to place on CVS. In this example this is a directory called project1 placed in the users home dir.
cd ~/project1
  • Now we import this as a new module:
cvs import -m "New project module" project1 s001234 start

The -m defines the import message "New project module". Unless you give the import command a message here, you will be prompted for it afterwards. After the message, a string project1 appears. This is the name of the module that will be placed on CVS: $CVSROOT/project1. You could have placed project1 in a subdir e.g. projects/project1, which would then be where the module would be placed. The student number appearing after is the vendor tag, which is a name for the module owner. Last but not least we give the import command a release tag: start. This indicates that our module is at a starting version.

Checkout a CVS module

To checkout a module called project1 to the current directory, type:

cvs checkout project1

If you want to checkout the module to a specific directory ~/projects , type:

cvs checkout -d ~/projects project1

Add a file

To add a file called report.tex , type:

cvs add report.tex

Be sure that the file is in the checked out module folder that you want to add it to.

Commit the changes you have made

To commit the changes you have made to a module, type:

cvs commit

You have to be located in the directory of the module you want to commit.

Update your local version of the module

To update the local version of the module you have checked out, go to the module folder and type:

cvs update

Remove a file from the module

To remove a file called picture.jpg from a module, type:

cvs remove picture.jpg

Additional help

See also this guide: http://ximbiot.com/cvs/manual/cvs-1.11.21/cvs_7.html#SEC69


Use another editor for log-messages

By default, CVS uses "vi" as the editor for log-messages. You can change this default behaviour by setting one of the following environment variables: $CVSEDITOR, $EDITOR or $VISUAL.

If you set more than one of these, $CVSEDITOR takes precedence over $EDITOR, which takes precedence over $VISUAL.


Windows

If you want to use CVS on your Windows computer at home, we recommend that you try TortoiseCVS.

For CVS use on the Windows machines at DTU, you may wish to follow this guide, kindly provided and maintained by s042551: WinCVS.


Troubleshooting

  • The CVS login command fails:
 cvs login: failed to open <path_to_your_home_dir>/.cvspass for
 reading: No such file or directory
 cvs [login aborted]: fatal error: exiting
This can be solved by issuing the following command:
 touch $HOME/.cvspass ; chmod go-r $HOME/.cvspass

The old CVS-server on logos.gbar.dtu.dk will be closed July 1st, 2007. Contact us and we will try to find an easy way to move your CVS-repository to the new server. The transfer will not happen automatically, since it involves some work on your part. (NB)

 

NOTICE

24
01 2017
Please note that the IT support office has been moved to the DTU library. Latex support remains in 308.
02
12 2015
Want to take advantage of the new GitLab service, or perhaps move your existing repos project over? Check out http://www.gbar.dtu.dk/faq/94-gitlab
05
09 2014
When you log in to your studentmail https://webmail.student.dtu.dk, remember to use your student number (sXXXXXX) as username.
07
04 2015
ShareLaTex We now offer ShareLatex, an online mulituser system for making LaTex documents. Check out http://gbar.dtu.dk/faq/91-sharelatex and https://www.sharelatex.com/