Generating “Unified Diff” Files with ClearCase
In my company, we recently migrated from CVS to ClearCase. We were a bit thrown off by the fact that ClearCase doesn’t readily provide diff files that span multiple files. We have all been used to reviewing CVS diff files which do so. People here had to come up with their own scripts to remedy this issue.
Here’s what I’ve been using so far:
cleartool lsco -cvi -r -s | xargs -n1 cleartool diff -pred -ser |
egrep -v "^(Files|Directories) are identical"
This Unix shell command will generate the diff output (which you can redirect to a file) recursively (-r) for all files that are checked out within the current directory, on the current view (-cvi).
The output is not exactly a unified diff file (I believe that it can’t be directly used with the patch command) but it still is a human-readable diff that spans multiple files.
The reason that I use -serial_format (-ser) and not -diff_format is that -diff_format suppresses the file headers and obviously a “unified diff” file doesn’t make sense when you don’t know where each individual file starts and ends.