I recently had to start over with my entire CVS setup for moodle development, and I'm now in a state where things are working, and this morning I was able to merge changes I made for my local site with the new moodle 1.6.2 code. I was up all night reading and getting help from buddies on IRC, so I figured someone is likely to be in my shoes, and why not help them out.
I'm in the position of *having* to use CVS, because not only is moodle stored in CVS, but after I checkout the moodle code, I make my edits, and I have to commit those changes to my local site's CVS server. The live site is a checkout from my local site's cvs server
If this explanation confuses you at all, *definitely* read http://cvsbook.red-bean.com/cvsbook.html#Tracking%20Third-Party%20Sources%20(Vendor%20Branches)
If you don't understand *that*, then backtrack through that online book to get a handle on the things that are confusing to you. I read about 100 pages of that book last night, and it was immensely helpful.
So here are the steps I took:
1. I downloaded moodle 1.6.1. I have a directory on my laptop that contains my changes, and those changes are based on 1.6.1, so the first step is to get 1.6.1 into my site's CVS repository. From there I'll apply my changes. Stay with me.
I untarred moodle 1.6.1 and did a cvs import, like so:
$ tar cvzf moodle-1.6.1.tar.gz
$ cd moodle
$ cvs -d :ext:bkj-moodle@cvs.mysite.edu:/cvs import MYMOODLE MOODLE_ORG MOODLE_161
NOTE: Those arguments that are in all caps are, in order, the directory/module I'm creating in the repository, the "vendor tag", and the "release tag".
2. Once it's in the local CVS repository, you can create a working area for yourself to checkout what you just checked in. Yes, that's right. I just checked in some stuff, and now I'm going to go check it out in a working area, because CVS knows nothing about the directory space you're in right now. You'll notice there's no "CVS" directories in the moodle directory. So:
$ cd ..
$ mkdir ~/cvs
$ cd cvs
$ cvs checkout MYMOODLE
This creates a MYMOODLE directory, which is your new cvs working area, where you'll do all of your work. Make whatever changes you want there, commit them to your local repository, etc., etc.
At this point, you should know that there's a default branch called HEAD. When you commit changes like I did above, they get committed to HEAD, and that branch, after your commit, will differ from the MOODLE_161 branch. You can verify this easily by running 'rdiff':
$ cvs rdiff -r MOODLE_161 -r HEAD MYMOODLE
The output will illustrate that HEAD and MOODLE_161 are, indeed, different.
3. Oh no! 1.6.2 is released and contains major security fixes! Ok, it's not the end of the world. Here's what happens: you download moodle 1.6.2. You untar it, and you cd into the directory. Once that's out of the way, you actually do another import, just like before, EXCEPT you *change* the "release tag" (the last tag in the import command above). Here's what I did:
$ tar xvzf moodle-1.6.2.tar.gz
$ cd moodle
$ cvs import MYMOODLE MOODLE_ORG MOODLE_162
When I did this, cvs reported 3 conflicts, which means there are three places where my code changes overlap with what's in the 1.6.2 code. It'll also give you a hint about how to merge your changes.
4. Now let's merge things such that the end result is 1.6.2, plus whatever customizations you've made:
$ cvs checkout -j MOODLE_161 -j MOODLE_162 MYMOODLE'
Wherever this command is run, it'll merge the stuff, and create a new "merged" checkout area called, in this case, MYMOODLE.
5. From there, it's a matter of using 'cvs status' and 'cvs diff' commands to find where your conflicts exist, and go fix them. That's basic CVS stuff, so I won't go over it here, but once you're done editing out conflicts, do a 'cvs commit' to commit your changes, and you're all set!