design for experience
My Drupal CVS cheatsheet
I was searching today for info on how to proceed on a specific Drupal CVS task, and in the first page of search results I happened upon a CVS examples document I put together for myself and subsequently posted in an online pastebin so a co-worker could grab a copy for himself. This was in the first page of Google's search results* and it got me to thinking, why don't I post this on my own site for reference and so that others could benefit.
The Drupal CVS documentation is fantastic. I particularly love the CVS maintainer's quickstart guide, but at the current time I'm mostly on Windows, using the command line CVS (CVSNT) that is installed along with WinCVS, and some of the directions in the Drupal documentation are a bit disparate (especially when you factor in Windows quirks), and rather than hunting and seeking, I'd just like to document what works for me when I need it. Perhaps I'll scrape these into a handbook page format and submit them sometime...
Please note, a number of these examples build upon, or may just be slight alterations of examples from the CVS Quickstart Guide on Lullabot.com. The difference here being, and the reason I'm posting them, is that I know the examples below work in my DOS shell with the above mentioned programs installed.
Without further ado...
CVS EXAMPLES
LOGIN TO DRUPAL CVS
cvs -d :pserver:username@cvs.drupal.org:/cvs/drupal-contrib loginLOGGING OUT
cvs logoutVIEW DRUPAL REPOSITORY ONLINE
http://cvs.drupal.org
- helpful for identifying branches and tags and for diffing
- can also view example modules, special docs, sandboxes, etc. in contributions areaCVS CHECKOUT: DRUPAL
CHECKOUT DRUPAL HEAD (i.e. the latest CVS version)
cvs -z6 -d :pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout drupalCHECKOUT DRUPAL BRANCH
cvs -z6 -d :pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal checkout -r DRUPAL-5 drupalCVS CHECKOUT: MODULE
CHECKOUT A MODULE, HEAD VERSION
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d MY/DIRECTORY/ contributions/modules/MODULE_NAMECHECKOUT A MODULE BRANCH
cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout -d MY/DIRECTORY/ -r DRUPAL-5 contributions/modules/MODULE_NAMENOTES:
- the -r parameter can be used to pick the branch/tag
- the -z parameter plus a value is used to set compression for net traffic
CVS COMMIT
STEP 1
- be in directory of the code to commit, making sure the CVS folder contains the proper tag metadata corresponding with our intended updates
- sync the module with any other updates which may have occured (backup files first, just in case)
cvs update -dP
STEP 2
- commit changes to the repository
cvs -d :pserver:username@cvs.drupal.org:/cvs/drupal-contrib commit -m "#123456 thanks to joe - short note on changes"CVS UPDATE (for current directory)
cvs update -dPCVS UPDATE TO A DIFFERENT BRANCH
cvs update -r DRUPAL-5 -dPCVS DIFF
(find all modified files and redirect the output to custom.diff)
cvs -d :pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal diff -u -F^f > custom.diffAdditions 10/29/07
MAKE A CORE PATCH USING CVS DIFF (be in Drupal root when executing)
From a directory...
cvs diff -uRp directory/to/check/for/patch > /where/to/put/my.patchI find the following to be a rather helpful implementation of the above, as it will check the whole Drupal site and redirect the patch to the desktop. Note: only use this on pristine copies of Drupal (except for the patched files of course) as this will capture your username and password from settings.php if it's been edited.
cvs diff -uRp ./ > ~/Desktop/my.patchAnd make a patch based on a single file...
cvs diff -up file-to-patch.php > my.patch