#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