Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm looking for a tool that will take diff / debdiff output (and more specifically, the output of this script) and display the result of the comparison in a highly readable, graphical way. Any pointers would be appreciated.

Ideally, it would be the GTK+, FOSS equivalent of MDR.

Meld, Diffuse and similar software are not fit for this purpose, since they're intended to work standalone, and don't take input from stdin.

share|improve this question

6 Answers 6

up vote 6 down vote accepted
+100

Kompare can do this (and is the best GUI diff-viewer IMO):

./whatchanged package_name | kompare -

Note the '-' given as the input file argument. Most *nix programs have this interface to accept piped input, so you can probably use whichever one you like.

share|improve this answer
    
Yes, I tried that with Meld, but what happens is that Meld is launched immediately and gets the intermediate output of the script, instead of launching once the script finishes and getting the diff output. I probably need to adjust the script's flow to work properly with Meld and other software it's piped to. And with "bzr diff" and regular diff output, Meld is launched in VCS mode, rather than file comparison mode. –  mgunes Nov 13 '10 at 1:51
    
I solved the VCS mode problem by launching Meld with the -a option. Kompare works as well. All that's left is to make the script pipe-aware. –  mgunes Nov 17 '10 at 22:07

I like using vim's internal syntax highlighting as a pager, so that I can view colorized diffs. For example, putting this in your .bashrc:

sudo apt-get install vim
alias vless='vim -u /usr/share/vim/vimcurrent/macros/less.vim'

(And then re-source your .bashrc with . ~/.bashrc.) Then you can run vless as your pager:

vless /path/to/your.diff

It's not graphical, but it is at least highlighted.

share|improve this answer
    
But he didn't ask for coloured diff files, he asked for graphical diffs. Which hints that you need to be able to read the original files as much as the diff itself. –  Martin Owens -doctormo- Nov 10 '10 at 8:26
    
Well, "read from stdin" was a requirement. If "Meld" has been ruled out, there's not much left. The other answer that creates the diff and opens Meld is the best bet for graphical. Or it could launch gedit instead. –  Kees Cook Nov 10 '10 at 17:34
    
you're not putting "sudo apt-get install vim" in your .bashrc, please edit to make it clear. –  barraponto Dec 10 '10 at 13:28

Although a KDE application it can be installed without TOO many dependencies, kdiff is an awesome diff editing / merge tool.

share|improve this answer
1  
While kdiff (aka kdiff3 in the ubuntu archive) is a great tool, it too does not satisfy the OP's question, as they are looking for a tool that will take a diff on STDIN and display it, and from the limited exploring I did, I couldn't see a way to make it do that. Also, if reducing KDE dependencies is an issue, the ubuntu archive includes kdiff3-qt, which only depends on qt and not libraries from the KDE stack. –  Steve Beattie Nov 10 '10 at 18:52

I would use this simple script to use meld (or any of the other existing tools), that way you get a little bit of flexibility:

#!/bin/bash

TMPDIR=`mktemp -d`
DIFF_FILE=`mktemp`
TARGET='./'

cat /proc/$$/fd/0 > $DIFF_FILE
cd $TARGET
rsync -apvz --delete --stats --compress --progress $TARGET $TMPDIR
patch -R -p0 -d $TMPDIR < $DIFF_FILE
meld $TARGET $TMPDIR

Tested with meld and the output from bzr diff, so copied this into /usr/bin and chmod 755 and I did this:

bzr diff | meld-diff

The results show as expected.

share|improve this answer
4  
While it's not as much of an issue on single-user machines, you ought to use mktemp and mktemp -d to generate your temporary file and directory safely, if for no other reason than so that you can perform diffs on multiple trees at the same time without one clobbering the other. –  Steve Beattie Nov 9 '10 at 5:58
    
Updated, thanks Steve! –  Martin Owens -doctormo- Nov 9 '10 at 17:06
    
It works with bzr diff, but only in directory comparison mode. I want to be able to compare individual files as well. I'll try to refine it to actually work with my script too, which it doesn't at the moment; thanks. –  mgunes Nov 11 '10 at 18:10
    
Mark me up if you think my idea of using the script is good. So far I've been marked down too much. –  Martin Owens -doctormo- Nov 11 '10 at 21:03

If you only have a console, colordiff is a quite good solution.

To install it, run this command sudo apt-get install colordiff in a terminal

share|improve this answer

I know you are not ask for a diff tool integrated to a editor, but I'm sure you can avoid context switch (from editor to terminal, and back to editor) after learn a bit about what your editor can provides. Both, emacs and vim comes with diff tools.

  • For emacs case, you will use Ediff Mode (instaled by default). Look at this wiki page or consulting the official manual

  • Using emacs is simple, just type Alt + x and type ediff.

  • You can use ediff to browser difference beetween branches and revisions of your repository (bzr, git, svn, etc).

share|improve this answer
    
Would you mind showing a quick example how to ediff remotely tracked git branch with a current working copy (multiple files)? –  mlt Jul 25 '13 at 5:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.