From a kdiff3 file comparison, can I generate a diff in unified diff format?
Asked Answered
M

2

19

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?

Muck answered 10/10, 2012 at 18:39 Comment(3)
I would have upvoted this, but apparently I did so when running into the same issue 2 months ago.Alduino
Cleartool has a diff command. Check the -diff_format option for a standard Unix style output.Garnett
I keep re-googling this question, and keep ending up using WinMerge to make a patch file (since you mention Windows, I thought adding WinMerge as a comment was fair game). His post's a little old, but Joachim said it doesn't exist in KDiff3 back in Dec 2011, and I took that somewhat quick answer to mean that it's not likely to come later. YMMV.Cesar
B
8

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).

Balcom answered 24/8, 2015 at 2:46 Comment(0)
B
-4

Don't bother with kdiff3. The command you're looking for is

cleartool diff --diff-format

Answered by John here: From a kdiff3 file comparison, can I generate a diff in unified diff format?

Brittani answered 7/10, 2013 at 20:40 Comment(1)
This might help the OP but it doesn't answer the question. Using KDiff3 on windows...Intisar

© 2022 - 2024 — McMap. All rights reserved.