TextMate + CVS or Diff bundle
Diff Bundle
Diff bundle is included with the default TextMate install.
Usage is pretty simple. Make a copy of the file you want to edit. After making your changes, save the file and select the menu item:
Bundles > Diff > Document with Arbitrary File...
Save with a .patch extension and your done.
CVS Bundle
The following applies to creating patch files for projects checked out through CVS.
There is also a CVS bundle available for the usual CVS tasks, i.e. committing, tagging, etc.. The 'cvs diff' command, however, is not suitable for submitting patch files to drupal.org. Luckily there's an easy way to overcome that.
First you have to grab the CVS bundle from their SVN repository (ironic, we know), since its not included with TextMate by default. Look in their documentation for instructions.
The easier alternative is to grab the bundle through the GetBundle bundle. -if it leads to a dead page then google it. validcode.net seems to be having trouble at the time of this writing.
After installing the GetBundle bundle, go to the Textmate menu bar and:
Bundles > GetBundle > Install Bundle.
From the drop-down list, select the CVS bundle and install. It will now be located inside:
/Users/yourAccount/Library/Application Support/TextMate/Pristine Copy/Bundles/CVS.tmbundle
NOTE: If you don't have a cvs bundle in that directory, it may be because you previously installed the CVS bundle without using the uber-cool GetBundle utility. Feel free to delete your current CVS bundle from within TextMate by using the Bundle Editor, found at Bundles > Bundle Editor > Show Bundle Editor. Have no fear, the GetBundle utility will download it for you at any time, provided you don't already have a copy of the CVS bundle already present in your TextMate.
Right click the CVS.tmbundle and select "Show Package Contents". The file you want to edit is located inside:
Support/versioned_file.rb.
Look for the lines reading:
if other_revision
cvs(:diff, "-r #{other_revision} -r #{revision}")
else
cvs(:diff, "-r #{revision}")
endAnd add the -up flags, like so:
if other_revision
cvs(:diff, "-up -r #{other_revision} -r #{revision}")
else
cvs(:diff, "-up -r #{revision}")
endSave then go back into TextMate and select the menu item:
Bundles > Bundle Editor > Reload All Bundles
Now when you go and select the cvs diff command, the output can be saved with a .patch extension and uploaded to an issue cue.
Warning! All patches will be created relative to the current directory (the directory in which the file is). This implies that it doesn't work properly for core patches!
