#cd to the root of drupal or root of modules directory
cvsdir=pserver:anonymous:anonymous@cvs.drupal.org:/cvs/
cvsfolder=drupal-contrib
version=DRUPAL-6--2 #usually HEAD , so don't need this option
version=HEAD
cvs -d:$cvsdir$cvsfolder diff -up -r $version calendar/calendar.inc > calendar_date_comparison.patch
To roll a patch using diff
diff -up path/to/file path_to/new_file > ~/patchname.patch
#checkout drupal HEAD into drupal folder in current directory
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co drupal
#d6 head
REV=DRUPAL-6
#specific revision
REV=DRUPAL-6-15
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r $REV drupal
#from contrib: http://drupal.org/node/321
REV=DRUPAL-6--2-0-BETA1
#6.x-2.x would be DRUPAL-6--2 (no trailing -- )
MOD=webform
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib co -r $REV -d $MOD contributions/modules/$MOD
#to create a patch: http://drupal.org/patch/create
MOD=webform
DESC=mypatch03
cd $MOD; cvs diff -up > ../$MOD-$DESC.patch ; cd ..
#to apply a patch (from within the top folder of the module/drupal
patch -u -p0