Moodle Docs: How to use CVS

## Using CVS to access and update Moodle source code

> CVS is the Concurrent Versioning System. It's a commonly used way of storing source code because it keeps versions of all files so that nothing is ever lost, and usage by different people is tracked. It also provides ways to merge code if two or more people are working on the same file. All code and all versions are stored on a central server (in the case of Moodle, at Sourceforge).

> If you just want to access the current CVS version of Moodle with read-only access then you don't need this page - just follow the simpler CVS instructions on the Moodle download page.

> To use Moodle's CVS archive (as a developer with write access), you first need to have an account on Sourceforge. For the examples on this page, let's assume your username is myusername and your password is mypassword. Take special note of the sourceforge instructions to create your CVS home directory - something you have to do with every new account to "enable" it for CVS. Basically you just have to use ssh to interactively connect to cvs.sourceforge.net.

> Once you have a working Sourceforge account, contact Martin Dougiamas so he can give you write access to particular Moodle directories.

> To avoid being prompted for mypassword every time you run a CVS command, follow the Sourceforge directions for using authorized keys. This step is optional, but it can make your CVS experience a lot nicer.

> With that done, you should have all the permissions you need, so you just need to set up your machine and download the current sources so you can start working on them. Below are instructions for Unix and Windows systems.

> ### 1. Using CVS on Unix

> > Sourceforge CVS uses ssh as a transport layer for security, so you will have to set this CVS_RSH environment variable in your Unix shell:

> > >     setenv CVS_RSH ssh (for csh, tcsh etc)

> > >     export CVS_RSH=ssh (for sh, bash etc)

> > It's best to put this in your .bashrc or .cshrc so you don't have to type it all the time. Then, check out Moodle using this (all one line):

> > >     cvs -z3 -d:ext:myusername@cvs.sourceforge.net:/cvsroot/moodle co moodle

> > Don't try to do run this first CVS command into an existing moodle directory - start fresh with a new directory.

> > Note that you will be prompted for mypassword for each command unless you set up authorized keys

> > Now, you should have a new 'moodle' directory. You can rename it and move it around if you like. Go into it:

> > >     cd moodle

> > All the latest Moodle files should be in there. You can now change files in your copy. To compare your files against the main CVS copy on the server use cvs diff, eg:

> > >     cvs diff -c config-dist.php
> > >     cvs diff -c lang

> > To fetch the latest updates from the server use:

> > >     cvs update -dP

> > To copy your new files back to the server you would do something like:

> > >     cd lang/ca
> > >     cvs commit

> > You will be prompted to add some comments (depends on your default text editor) ... add a meangingful comment and close the editor ... the files will be sent to Sourceforge and stored. Done!

> > To save more time you can put default arguments into a file called .cvsrc in your home directory. For example, mine contains:

> > >     diff -c
> > >     update -dP

> > Try 'cvs help' for more details ...

> ### 2. Using CVS on Windows

> > First, you need to download a completely fresh copy of Moodle using your developer account.

> > > 1. Get TortoiseCVS from tortoisecvs.org and install it, then reboot.
> > > 2. Find or create a new folder somewhere where you want Moodle to be downloaded to.
> > > 3. Right-mouse-click that folder and choose "CVS Checkout" from the menu. You should see a dialog box.
> > > 4. Copy this text into the CVSROOT field (using your own username!):

> > > >      :ext:myusername@cvs.sourceforge.net:/cvsroot/moodle

> > > 5. Press the button: "Fetch list...".
> > > 6. To the right of the button you should see a list of modules: choose "moodle" from that list.
> > > 7. Press the button: "OK" and everything should be downloaded.

> > A dialog box should show all the files being downloaded, and after a while you should have a complete copy of Moodle. After this first checkout, you can fetch the latest updated files from the CVS server:

> > > 1. Right-mouse-click on your Moodle folder (or any file) and select "CVS Update".

> > After modifying files (you will note they change from green top red!), you can commit them back to the CVS server like this:

> > > 1. Right-mouse-click on your Moodle folder (or any file) and select "CVS Commit...".
> > > 2. In the dialog box, type a clear description of the changes you are committing.
> > > 3. Click "OK". Your changes will be sent to the server.

> Good luck!

Moodle Documentation

Version: $Id$