I have a kdiff3 comparison in Windows, and I would like to save the comparison as a text file in unified diff format.
I realize this is kind of a strange question. Usually, people already have the text diff in hand, and want to see it graphically in kdiff3.
I'm using an ... unusual ... version control tool in Windows, and it can compare versions and display the comparison in kdiff3. However, it is decidedly unfriendly in generating Unix-friendly output, at least for non-ClearCase-ninjas like me.
What I would really, truly, love is to get the output of the comparison in a unified diff format, so I can use tools like patch
or similar. I do not particularly love ClearCase, and I would be happy to leave it alone as much as possible.
Can kdiff3 take an existing comparison and export it to a unified diff format?
kdiff3 in Windows tends to come with the standard command-line diff utils as well -- look in your C:\Program Files*\KDiff3\bin
folder; if diff.exe is there, you can use that (the standard diff -u file1 file2
). (If it's not there, re-run the kdiff3 installer and select the "Utilities" option.)
If you're looking at some files in a running kdiff3 that was auto-launched from ClearCase, open a command prompt in the kdiff3 bin directory (or copy the contents of the bin directory into C:\Windows
to make these commands work from anywhere) and do:
diff -u "<copy-pasted path of file A>" "<copy-pasted path of file B>"
where the paths for file A and file B come from your kdiff3 window (doesn't matter if they're temporary files; they'll exist as long as the kdiff3 window is open).