Patching shortcuts

Last modified: February 19, 2008 - 03:55

(Reposted with permission from http://acko.net/blog/handy-drupal-core-development)

Some quick tips for better productivity when developing Drupal core:

  • Alias your editor to e. If you use a GUI editor see if it comes with a command-line shortcut to use (to avoid having to browse to the file again). TextMate by default has /usr/bin/mate. Not nearly short enough ;).
  • Set up a d (diff) command to perform diffs. I use the following:
    cvs diff -u -N -F^f . | grep -v -e ^\? > $1.patch
    e $1.patch

    This takes a patch name as the argument. It will do a diff and open up my editor afterwards so I can review the patch before submitting. The grep strips out unnecessary junk (unknown files).

  • Set up a p (patch) command to apply patches. I use the following:

    wget -O - $1 | patch -p0

    This will take a patch URL and apply it locally.

  • Set up a c (clean) command to clean a CVS tree:

    cvs up -C -d .

  • Finally top it off with this fun gem t (try out):

    c; p $1; e .; d d

    This command takes a patch URL as its argument, will apply it to the local check out after cleaning it up, and will then open the editor on the root as well as show you the final diff against latest CVS.

The attachment below contains bash scripts for these commands, but requires the e alias to work.

AttachmentSize
drupalbin.tgz325 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.