Sunday, April 5, 2009

Command of the day: interdiff

Often, when working in code projects, I have to keep some local changes uncommited because I am offline or because i am doing some experiment and i am not sure that it will be successful. In those cases you end up doing a big commit with has very low grain to rollback any regressive change. Sure new distributed VCS allow offline commits but we are working with subversion. So I was glad when i recently discovered how to use interdiff command.

If you plan to make a set of offline changes, on each point you would commit, just take an 'svn diff' on a file. Given those accomulative diffs respect the BASE revision, interdiff knows how to extract the incremental ones from one state to the next one so. When you are back online, you revert all changes, apply and commit each patch separately.

Other interesting commands to manage patches (available in the patchutils package):

  • combinediff: the reverse, joins two patches together
  • recountdiff: very useful when you want to reapply a patch but the state of the code has changed.
  • flipdiff: exchanges the order of two pages
  • filterdiff: remove the changes affecting a set of files from an existing patch
No excuses for coarse commits after on-flight coding to Parma!

No comments: