4

I need a GUI program for Linux (Ubuntu Karmic) like tkdiff, which can display 2 files side-by-side, and highlight the differing lines, and it accepts multiple file pairs on the command line, but displays only one file pair at a time, and lets me jump to the next or previous file pair by pressing a key. Which is the best program for this?

I've tried tkdiff and meld, but it seems to be impossible to specify more than 2 files for these on the command-line.

1
  • 3
    I believe older versions of tkdiff (3.x) had this feature, and newer ones (4.x) do not.
    – user138820
    Jun 8, 2012 at 0:34

6 Answers 6

2

I've been fighting with TkDiff multi-pair diffs also. So far I've only managed to get the very unhelpful:

Error: you specified 6 file(s) and 0 revision(s)

...but I'll add my experience and some notes here.

Perforce here at work is already does the right thing for me.

Here's what ps says for a nice working Perforce multi-pair diff (I've moved every separate argv item onto it's own line):

wish
/tools/eng/perforce/tkdiff.tcl
--
:
/tmp/g4-60077/cache/depot/path/to/file1#740
/home/douglasdd/work/src1/path/to/file1
:
/tmp/g4-60077/cache/depot/path/to/file2#15
/home/douglasdd/work/src1/path/to/file2

From this I'm guessing that part of what's missing in Leon's answer above is the '--' and ':' before the first file pair. BUT this is not enough.

Our perforce version of TkDiff is ancient (3.0x) so I'm trying to use my locally installed 4.1.x version. But no luck so far...

Manually running this works:

wish /tools/eng/perforce/tkdiff.tcl -- : "/tmp/g4-60077/cache/depot/path/to/file1#740" /home/douglasdd/work/src1/path/to/file1 : "/tmp/g4-60077/cache/depot/path/to/file2#15" /home/douglasdd/work/src1/path/to/file2

But manually running this fails:

wish /usr/local/bin/tkdiff -- : "/tmp/g4-60077/cache/depot/path/to/file1#740" /home/douglasdd/work/src1/path/to/file1 : "/tmp/g4-60077/cache/depot/path/to/file2#15" /home/douglasdd/work/src1/path/to/file2

...with the dreaded:

Error: you specified 6 file(s) and 0 revision(s)

From which I'm force to wonder if perhaps Perforce has their own custom-hacked version of TkDiff??

Sorry this doesn't really help.

1

Try arranging for the files to compare to have the same name in different directories, i.e., comparing foo/file1 with bar/file1, foo/file2 with bar/file2, etc. You can use symbolic links. Then use a diff tool that understands comparing directories. Emacs is one such tool (menu “Tools / Compare / Two directories” or M-x ediff-directories).

1
  • Thanks for suggesting this workaround. However, I'm still looking for a more straightforward solution, which avoids creating temporary files (or symlinks) and directories, just to do a multifile comparison.
    – pts
    Aug 28, 2010 at 11:07
0

I like kdiff3 it can do 2 or 3 files - and can compare directories.

3
  • This doesn't answer my question. Many diff tools can compare 2 or 3 files. I'm interested in a diff tool which can compare more than 1 file pair, which I can specify on the command line.
    – pts
    Aug 28, 2010 at 11:05
  • sorry I don't know of any tool that does this - it would be simple to write a small script that calls kdiff or similar for each pair of files passed to it Aug 28, 2010 at 18:39
  • 1
    Thanks for coming up with a 2nd suggestion (a shell script which calls kdiff multiple times), but it still doesn't answer my question. In my question I explicitly specify the requirement that the program ``lets me jump to the next or previous file pair by pressing a key''.
    – pts
    Aug 28, 2010 at 23:37
0

Since nobody could suggest a tool which matches my requirements, most probably there is none.

0

tkdiff is really poorly documented, but it seems that if you separate file pairs by a colon, it'll do the diff you want. E.g.

tkdiff a.1 a.2 : b.1 b.2 : c.1 c.2
1
  • This doesn't work with tkdiff 4.1.4, I get `You specified 5 file(s) and 0 revision(s)
    – pts
    Sep 19, 2010 at 13:12
-1

meld is a very nice utility to diff between different files and even directory structures.

To diff between multiple files:

meld $file1 $file2 $file3

To diff between two different directories:

meld $dir1 $dir2
1
  • Thank you for trying to help. I fail to see though how this answers my question. More specifically: how do I specify multiple file pairs for meld?
    – pts
    Apr 22, 2017 at 12:22

You must log in to answer this question.

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