Tim Hatch

Weblog | Photos | Projects | Panoramas | About

Cherrypick

This script allows you to take a unified diff and split its separate edits into new diff files. Right now it assumes a unix-like system that supports vt100 escapes and isn't complete. Most notably it doesn't do commandline parsing or allow you to edit the diff chunks (in case two edits were very close-by).

Downloads

Get it from bzr for now:

bzr branch http://code.timhatch.com/bzr/cherrypick/

Changelog

2007-10-18: 7
  • Diffs now work with hg's
2007-07-20: 6
  • Diffs now work with bzr's
  • Clarified license to be bsd
2007-06-29: 1
  • Allows diff blocks to be split out to an arbitrary number of files successfully. Doesn't update line information yet, resulting in possible issues when merging.

Example Usage

svn diff > tempfile
python cherry-pick.py tempfile
# user input to put something to a.diff, something else to b.diff
patch -p0 -R < b.diff
#files reflect changes from a.diff only now

Contributing

I welcome patches, suggestions, and bugreports. Send me an email to code@timhatch.com