-<html>
-<head>
-<title>Moodle Docs: How to use CVS</title>
- <link rel="stylesheet" href="docstyles.css" type="TEXT/CSS">
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-</head>
-<body bgcolor="#ffffff">
-<h1>Using CVS to access and update Moodle source code</h1>
-<blockquote>
- <p>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 <a target="_top" href="http://www.sf.net/">Sourceforge</a>).
- </p>
- <p>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 <a target="_top" href="http://moodle.org/download">Moodle download page</a>.</p>
-
- <p>To use <a target="_top" href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/moodle/moodle/">Moodle's
- CVS archive</a> (as a <a target="_top" href="http://sourceforge.net/project/memberlist.php?group_id=30935">developer
- with write access</a>), you first need to have an <a href="http://sourceforge.net/account/register.php">account
- on Sourceforge</a>. For the examples on this page, let's assume your username
- is <strong><font color="#990000">myusername</font></strong> and your password
- is <strong><font color="#990000">mypassword</font></strong>. Take special note of the
- sourceforge instructions to <a target="_top" href="http://sourceforge.net/docman/display_doc.php?docid=768&group_id=1#develhomedir">create your CVS home directory</a> - 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.</p>
-
- <p>Once you have
- a working Sourceforge account, contact <a
- target="_top" href="http://moodle.org/user/view.php?id=1&course=1">Martin Dougiamas</a> so he can give you write access
- to particular Moodle directories.</p>
-
- <p>To avoid being prompted for <strong><font color="#990000">mypassword</font></strong>
- every time you run a CVS command, follow the <a target="_top" href="http://sourceforge.net/account/editsshkeys.php">Sourceforge
- directions for using authorized keys</a>. This step is optional, but it can
- make your CVS experience a lot nicer.</p>
- <p>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.</p>
- <h2>1. Using CVS on Unix</h2>
- <blockquote>
- <p>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:</p>
- <blockquote>
- <pre><strong>setenv CVS_RSH ssh</strong> (for csh, tcsh etc)</pre>
- <pre><strong>export CVS_RSH=ssh</strong> (for sh, bash etc)</pre>
- </blockquote>
- <p>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): </p>
- <blockquote>
- <pre><strong>cvs -z3 -d:ext:myusername@cvs.sourceforge.net:/cvsroot/moodle co moodle</strong></pre>
- </blockquote>
- <p>The command is similar for other CVS modules (such as the contrib folder or the MySQL Admin folder):</p>
- <blockquote>
- <pre><strong>cvs -z3 -d:ext:myusername@cvs.sourceforge.net:/cvsroot/moodle co contrib</strong><br />
-<strong>cvs -z3 -d:ext:myusername@cvs.sourceforge.net:/cvsroot/moodle co mysql</strong></pre>
- </blockquote>
- <p>Don't try to do run this first CVS command over an existing moodle installation
- - start fresh with a new directory.</p>
- <p>Note that you will be prompted for <strong><font color="#990000">mypassword</font></strong>
- for each command unless you set up <a target="_top" href="http://sourceforge.net/account/editsshkeys.php">authorized
- keys</a></p>
- <p>Now, you should have a new 'moodle' directory. You can rename it and move
- it around if you like. Go into it: </p>
- <blockquote>
- <pre><strong>cd moodle </strong></pre>
- </blockquote>
- <p>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: </p>
- <blockquote>
- <pre><strong>cvs diff -c config-dist.php
-cvs diff -c lang</strong></pre>
- </blockquote>
- <p>To fetch the latest updates from the server use: </p>
- <blockquote>
- <pre><strong>cvs update -dP</strong> </pre>
- </blockquote>
- <p>To copy your new files back to the server you would do something like:
- </p>
- <blockquote>
- <pre><strong>cd lang/ca
-cvs commit</strong> </pre>
- </blockquote>
- <p>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! </p>
- <p>To save more time you can put default arguments into a file called .cvsrc
- in your home directory. For example, mine contains: </p>
- <blockquote>
- <pre><strong>diff -c
-update -dP</strong> </pre>
- </blockquote>
- <p>Try 'cvs help' for more details ... </p>
- <p> </p>
- </blockquote>
- <h2>2. Using CVS on Windows</h2>
- <blockquote>
- <p>First, you need to download a completely fresh copy of Moodle using your
- developer account.</p>
- <blockquote>
- <p> 1. Get TortoiseCVS from <a target="_top" href="http://www.tortoisecvs.org/">tortoisecvs.org</a>
- and install it, then reboot.<br>
- <br>
- 2. Find or create a new folder somewhere where you want Moodle to be downloaded
- to.<br>
- <br>
- 3. Right-mouse-click that folder and choose "<strong>CVS Checkout</strong>"
- from the menu. You should see a dialog box.<br>
- <br>
- 4. Copy this text into the CVSROOT field (using your own username!):</p>
- <blockquote>
- <pre> :ext:<font color="#990000">myusername</font>@cvs.sourceforge.net:/cvsroot/moodle</pre>
- </blockquote>
- <p><br>
- 5. Under the "Module" field, type "<strong>moodle</strong>" to get Moodle, "<strong>contrib</strong>" to get the contributions directory, or "<strong>mysql</strong>" to get the MySQL Admin module.<br>
- <br>
- 7. Press the button: "<strong>OK</strong>" and everything should
- be downloaded.<br>
- </p>
- </blockquote>
- <p>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:</p>
- <blockquote>
- <p> 1. Right-mouse-click on your Moodle folder (or any file) and select
- "<strong>CVS Update</strong>". <br>
- </p>
- </blockquote>
- <p>After modifying files (you will note they change from green top red!),
- you can commit them back to the CVS server like this:</p>
- <blockquote>
- <p> 1. Right-mouse-click on your Moodle folder (or any file) and select
- "<strong>CVS Commit...</strong>".<br>
- <br>
- 2. In the dialog box, type a clear description of the changes you are
- committing. <br>
- <br>
- 3. Click "OK". Your changes will be sent to the server.<br>
- </p>
- </blockquote>
- </blockquote>
- <p> </p>
- <p align="center">Good luck!</p>
- <p> </p>
-</blockquote>
-<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>
-<p align="CENTER"><font size="1">Version: $Id$</font></p>
-</body>
-</html>
+<html>\r<head>\r<title>Moodle Docs: How to use CVS</title>\r <link rel="stylesheet" href="docstyles.css" type="TEXT/CSS">\r <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">\r <style type="text/css">\r<!--\r.style1 {color: #990000}\r-->\r </style>\r</head>\r<body bgcolor="#ffffff">\r<h1>CVS for Moodle Developers</h1>\r<blockquote> \r <p>CVS is the <strong>Concurrent Versioning System</strong>, a commonly-used way of managing \r source code for large software projects. CVS keeps all versions of all files so that nothing is ever \r lost, and usage by different people is tracked. It also provides ways to merge \r code if two or more people are working on the same file. All code and all \r versions are stored on a central server (in the case of Moodle, at <a target="_top" href="http://www.sf.net/">Sourceforge</a>). \r </p>\r <p>If you just want to download Moodle using CVS to run a site, then \r you probably don't need this page - just follow the simpler CVS instructions on the <a target="_top" href="http://moodle.org/download">Moodle download page</a>.</p>\r <p> </p>\r <ol>\r <li><a href="#1">Joining the project as a developer</a></li>\r <li><a href="#2">CVS Modules</a> </li>\r <li><a href="#3">Basic CVS Commands</a> <br>\r 3.1. <a href="#3.1">CVS on Unix</a> <br>\r 3.2. <a href="#3.2">CVS on Windows</a></li>\r <li> <a href="#4">Working with Branches</a><br>\r 4.1. Trunk development<br>\r 4.2. Stable branches for each release<br>\r 4.3. Feature branches for large changes </li>\r </ol>\r <p> </p>\r <h2><a name="1"></a>1. Joining the project as a developer</h2>\r <blockquote>\r <p>So, you've been offered CVS write access to help us develop and maintain Moodle! <a href="http://sourceforge.net/project/memberlist.php?group_id=30935">Welcome aboard</a>!</p>\r <p>To be able to write changes into <a target="_top" href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/moodle/moodle/">Moodle's \r CVS archive</a>, you first need to have an account at Sourceforge (<a href="http://sourceforge.net/account/register.php">registration is free and easy</a>). For the examples on this page, let's assume your username \r is <strong><font color="#990000">myusername</font></strong> and your password \r is <strong><font color="#990000">mypassword</font></strong>. Take special note of the \r sourceforge instructions to <a target="_top" href="http://sourceforge.net/docman/display_doc.php?docid=768&group_id=1#develhomedir">create your CVS home directory</a> - something you have to\r do with every new account to "enable" it for CVS. Basically you just have to use ssh to interactively connect to cvs.sourceforge.net.</p>\r <p>Once you have \r a working Sourceforge account, contact <a \r target="_top" href="http://moodle.org/user/view.php?id=1&course=1">Martin Dougiamas</a> so he can set up your account with write access \r to particular Moodle directories.</p>\r <p>To avoid being prompted for <strong><font color="#990000">mypassword</font></strong> \r every time you run a CVS command, follow the <a target="_top" href="http://sourceforge.net/account/editsshkeys.php">Sourceforge \r directions for using authorized keys</a>. This step is optional, but it can \r make your CVS experience a lot nicer.</p>\r <p>With that done, you should have all the permissions you need, so you just \r need to set up your machine and download the current sources so you can start \r working on them. </p>\r <p> </p>\r </blockquote>\r <h2><a name="2" id="2"></a>2. CVS Modules</h2>\r <blockquote>\r <p>Within CVS, the word "modules" refers to separate collections of code. In Moodle we have the following modules within our repository:</p>\r <blockquote>\r <p><strong>moodle</strong> - the main Moodle source code</p>\r <p><strong>contrib</strong> - user contributions and other assorted code in development</p>\r <p><strong>mysql</strong> - customised phpMyAdmin to plug into Moodle for database admin</p>\r <p><strong>windows-cron</strong> - a small package that makes cron possible on Windows systems</p>\r <p><strong>docs</strong> - various extra user-contributed documentation</p>\r </blockquote>\r <p>Most people are working on the existing features in the <strong>moodle</strong> module, but many are also contributing new ideas in the <strong>contrib</strong> modules. Once code reaches a certain level of maturity in the <strong>contrib</strong> area, it migrates over into the main <strong>moodle</strong> tree. </p>\r <p> </p>\r </blockquote>\r <h2><a name="3" id="3"></a>3. Basic CVS Commands </h2>\r <h3><a name="3.1" id="3.1"></a>3.1 CVS on Unix </h3>\r <blockquote> \r <p>Sourceforge CVS uses ssh as a transport layer for security, so you will \r have to set a CVS_RSH environment variable in your Unix shell. It's best to put these commands in your .bashrc or .cshrc so you don't have to type \r it all the time<strong>:</strong></p>\r <blockquote> \r <pre><strong>setenv CVS_RSH ssh</strong> (for csh, tcsh etc)</pre>\r <pre><strong>export CVS_RSH=ssh</strong> (for sh, bash etc)</pre>\r </blockquote>\r <p>Next, you can check out the latest development version of Moodle using this (all one line): </p>\r <blockquote> \r <pre><strong>cvs -z3 -d:ext:<span class="style1">myusername</span>@cvs.sourceforge.net:/cvsroot/moodle co moodle</strong></pre>\r </blockquote>\r <p>The command is similar for other CVS modules:</p>\r <blockquote> \r <pre><strong>cvs -z3 -d:ext:<span class="style1">myusername</span>@cvs.sourceforge.net:/cvsroot/moodle co contrib</strong></pre>\r </blockquote>\r <p>Don't try to do run this first CVS command over an existing moodle installation: start fresh with a new directory.</p>\r <p>Note that you will be prompted for <strong><font color="#990000">mypassword</font></strong> \r for each command unless you set up <a target="_top" href="http://sourceforge.net/account/editsshkeys.php">authorized \r keys</a>.</p>\r <p>Now, you should have a new 'moodle' directory. You can rename it and move \r it around if you like. Go into it: </p>\r <blockquote> \r <pre><strong>cd moodle </strong></pre>\r </blockquote>\r <p>All the latest Moodle files should be in there. You can now change files \r in your copy. To compare your files and directories against the main CVS copy on the server \r use cvs diff, eg: </p>\r <blockquote> \r <pre><strong>cvs diff -c config-dist.php\rcvs diff -c lang</strong></pre>\r </blockquote>\r <p>To fetch the latest updates from the server use: </p>\r <blockquote> \r <pre><strong>cvs update -dP</strong> </pre>\r </blockquote>\r <p>To copy your new files back to the server you would do something like: \r </p>\r <blockquote> \r <pre><strong>cd lang/ca \rcvs commit</strong> </pre>\r </blockquote>\r <p>You will be prompted to add some comments (depends on your default text \r editor) ... add a meangingful comment and close the editor ... the files \r will be sent to Sourceforge and stored. Done! </p>\r <p>To save more time you can put default arguments into a file called .cvsrc \r in your home directory. For example, mine contains: </p>\r <blockquote> \r <pre><strong>diff -c \rupdate -dP</strong> </pre>\r </blockquote>\r <p>Try 'cvs help' for more details ... </p>\r <p> </p>\r </blockquote>\r <h3><a name="3.2" id="3.2"></a>3.2 CVS on Windows </h3>\r <blockquote> \r <p>First, you need to download a completely fresh copy of Moodle using your \r developer account.</p>\r <ol>\r <ol>\r <li> Get TortoiseCVS from <a target="_top" href="http://www.tortoisecvs.org/">tortoisecvs.org</a> and install it, then reboot.</li>\r <li>Find or create a new folder somewhere where you want Moodle to be downloaded \r to.</li>\r <li>Right-mouse-click that folder and choose "<strong>CVS Checkout</strong>" from the menu. You should see a dialog box.</li>\r <li>Copy this text into the CVSROOT field (using your own username!):\r <pre> :ext:<font color="#990000">myusername</font>@cvs.sourceforge.net:/cvsroot/moodle</pre>\r </li>\r <li>Under the "Module" field, type "<strong>moodle</strong>" to get the latest development version of Moodle, "<strong>contrib</strong>" to get the contributions directory, or "<strong>mysql</strong>" to get the MySQL Admin module.</li>\r <li>Press the button: "<strong>OK</strong>" and everything should \r be downloaded.<br>\r </li>\r </ol>\r </ol>\r <p>A dialog box should show all the files being downloaded, and after a while \r you should have a complete copy of Moodle. After this first checkout, you \r can fetch the latest updated files from the CVS server:</p>\r <ol>\r <ol>\r <li> Right-mouse-click on your Moodle folder (or any file) and select "<strong>CVS Update</strong>". </li>\r <li>Sit back and watch the logs scroll by. Take note of conflicts that may occur if your local code has changes that conflict with the incoming versions - you will need to edit these files and resolve the conflicts manually. <br>\r </li>\r </ol>\r </ol>\r <p>After modifying files (you will notice their icons change from green to red!), \r you can commit them back to the CVS server like this:</p>\r <ol>\r <ol>\r <li> Right-mouse-click on your Moodle folder (or any file) and select "<strong>CVS Commit...</strong>".</li>\r <li>In the dialog box, type a clear description of the changes you are \r committing.</li>\r <li>Click "OK". Your changes will be sent to the server.<br>\r </li>\r </ol>\r </ol>\r </blockquote>\r <h2><a name="4" id="4"></a>4. Working with Branching</h2>\r <blockquote>\r <p>This diagram shows how the main <strong>moodle</strong> module branches into different versions over time.</p>\r <p align="center"><img src="pix/cvstree.png" width="500" height="200"></p>\r <h3><a name="4.1" id="4.1"></a>4.1 Trunk development</h3>\r <p>The Trunk of CVS is the main development version of Moodle. In CVS it is also known as the HEAD, or default branch.</p>\r <p>Moodle developers try to keep this stable as possible, but as it usually contains new code it probably has bugs and small instabilities.</p>\r <p>Every now and then we decide the product has enough features to make a release. At this time, the trunk is tagged with a MOODLE_XX_BETA tag (in case we ever want to roll back to that point) and a new branch is formed for the release, called <span class="style1">MOODLE_XX_STABLE</span>. </p>\r <p>A Beta package is also released at this point - it's for testers who don't use CVS but want to test the latest features and report bugs.</p>\r <h3><a name="4.2" id="4.2"></a>4.2 Stable branches for each release</h3>\r <p>As soon as the stable branch <span class="style1">MOODLE_XX_STABLE</span> is created, development efforts will fork into two streams for a while. Some people may continue working on new features in the trunk for the next release, but most developers should be concentrating on using the current STABLE branch and fixing bugs that are found in it. </p>\r <p>You can switch your local copy of Moodle to the STABLE version using the following command in Unix from the root directory:</p>\r <blockquote>\r <pre><strong>cvs update -dP -r MOODLE_XX_STABLE</strong></pre>\r </blockquote>\r <p>After that, all the commands described above will apply to that stable version. To return to the trunk version just issue:</p>\r <blockquote>\r <p><strong>cvs update -dPA</strong> </p>\r </blockquote>\r <p>On Windows clients you should have a menu from which you can choose the branch. </p>\r <p>Once the new STABLE branch really stabilises, a release can be declared. Packages are created for distribution and the branch will be tagged (by Martin) with a tag named: MOODLE_XX</p>\r <p>Periodically, bug fixes in the STABLE branch should be merged into the trunk so that they become available in future versions of Moodle. A floating tag called MOODLE_XX_MERGED will be maintained to keep track of the last merge. The procedure for such a merge is as follows:</p>\r <ol>\r <ol>\r <li><strong> cvs update -dPA</strong></li>\r <li><strong>cvs update -j MOODLE_13_MERGED -j MOODLE_13_STABLE</strong></li>\r <li><strong>cvs commit </strong></li>\r <li><strong> cvs update -dPr MOODLE_13_STABLE</strong></li>\r <li><strong>cvs tag -RF MOODLE_13_MERGED</strong></li>\r </ol>\r </ol>\r <p> </p>\r <h3><a name="4.3" id="4.3"></a>4.3 Feature branches for large changes </h3>\r <p>Occasionally, there may be a very large feature that needs to be checked in so several people can work on it, but it is too unstable to be included in the main development trunk.</p>\r <p>In these cases a short-term branch can be created to work on the feature, and then merged back into the main trunk as soon as possible. An example called MOODLE_14_WIDGET branch can be seen in the above diagram.</p>\r <p>If you need to do this for your new WIDGET feature, follow these steps:</p>\r <ol>\r <ol>\r <li>Discuss with other developers to make sure it's necesary.</li>\r <li>Make a tag on the <strong>trunk</strong> called MOODLE_XX_WIDGET_PRE</li>\r <li>Create your branch called MOODLE_XX_WIDGET</li>\r <li>Work in that branch until the feature is reasonably stable.</li>\r <li>Merge the whole branch into the trunk and abandon the branch.</li>\r </ol>\r </ol>\r <p> </p>\r </blockquote>\r <p align="center">Good luck!</p>\r <p> </p>\r</blockquote>\r<p align="CENTER"><font size="1"><a href="." target="_top">Moodle Documentation</a></font></p>\r<p align="CENTER"><font size="1">Version: $Id$</font></p>\r</body>\r</html>\r
\ No newline at end of file