2

When I use meld to obtain visual diff, I can merely run this from the command line:

$ meld file1.txt file2.txt

... and meld starts, loads each file in a separate subwindow, and shows the differences side by side.

I'm trying to do the same with Kompare:

$ kompare file1.txt file2.txt

... but I get error: "Could not parse diff output.". And the same error holds for:

$ kompare -c file1.txt file2.txt
$ kompare -c file:///path/to/file1.txt file:///path/to/file2.txt

I also tried:

$ diff file1.txt file2.txt | kompare -o - 

... that doesn't raise an error - but it shows Source/Destination folder as "unknown" (and otherwise, everything else blank)?!

 

Is it possible at all to use Kompare as I'd intend to? If so, how should the command line be formatted?

Many thanks in advance for any answers,
Cheers!

 

Edit: there's a ton of bugs related to this, it turns out:

... could be any of this, I guess..

 

Edit2: getting closer, I guess; since this is on OpenSuse 11.2,

> kompare --version
Qt: 4.5.3
KDE: 4.3.1 (KDE 4.3.1) "release 6"
Kompare: 4.0.0
> diff --version
diff (GNU diffutils) 2.8.7-cvs

... I tried to look for some patches in the system:

> find / -xdev -name "*.patch" 2>/dev/null
...
/etc/YaST2/policy.patch
/etc/YaST2/liveinstall.patch

... and so I tried to view one of these:

kompare -o /etc/YaST2/policy.patch

... and that one at least opens and shows some differences in kompare, so at least there is a reference diff file to compare with...

2 Answers 2

2

Try

$ kompare -c file1.txt file2.txt

The reason the piped command doesn't work is that for historical reasons, diff doesn't produce the patch format that most of us are used to, with context and + and -. You have to use diff -u to get this:

$ diff -u file1.txt file2.txt | kompare -o -
2
  • Thanks for that, @stharward - it was noted in OP that kompare -C fails; I just tried diff -u and that one fails as well :( At least I managed to find default system patches that do open in Kompare, so I can use them for comparison... Cheers!
    – sdaau
    Nov 9, 2011 at 14:18
  • 1
    @sdaau: You could also try using kdiff3 instead of kompare, which will do 2-diffs just fine as well. I actually prefer kdiff3 because its keyboard navigation is better.
    – stharward
    Nov 9, 2011 at 23:26
1

I think I got it...

My problem is that I wanted to diff VHDL files; in VHDL, a comment is two minus signs; so say I've had this comment in the file file1.vhd:

...
-- my comment A
...

and I've replaced it to this in file2.vhd

...
-- my comment B
...

Thus, now if I run a unified diff on these two files, I'd get something like::

--- path/to/file1.vhd   2011-11-09 11:15:46.800513032 +0000
+++ path/to/file2.vhd   2011-11-09 12:17:35.764027670 +0000
@@ -1,5 +1,5 @@
 ...
--- my comment A
+-- my comment B
 -- ...
 -- ...
 --

 

Notice that? The - from the diff (meaning "this line removed"), merged with the -- (which were original content: comments in the .vhd file) - to create --- which in terms of diff is an identifier for a file (see first line in snippet above)!

 

Thus, since Kompare doesn't plainly "open" files, even through the GUI - even if you specify two files, Kompare first apparently runs them through a diff, and then tries to parse that diff -- apparently, first by looking for +++ and --- to identify participating files; which causes the "VHDL comment line" to be wrongly interpreted. To show this, I simply had to insert a space in the diff file:

- -- my comment A

... and then it could load in Kompare.

Well, this apparently means that I now would have to indent all of my *.vhd files, to have them compatible with diff->Kompare pipeline ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .