Joelio
Joelio

Reputation: 4691

how to see whitespace chars in svn diff?

 $svn diff my.object 
 -        <description>reverse reference to the Update Center Enrollment Application task.
 +        <description>reverse reference to the Update Center Enrollment Application task.

It must be a white space/hidden char or a end of line problem.... but how do I figure it out?

Upvotes: 4

Views: 2857

Answers (4)

m13r
m13r

Reputation: 2721

A more readable approach could be:

svn diff myfile --diff-cmd colordiff | less -R

It somehow only worked when using colordiff.

Upvotes: 0

Joelio
Joelio

Reputation: 4691

Well, I figured out a simple work around

svn diff my.object > foo.txt

then use:

od -c foo.txt

It shows the new line chars, and I found one had \n and the other had \r\n.

Upvotes: 2

Ivan Zhakov
Ivan Zhakov

Reputation: 4041

Just pipe output to preferred program. E.g.

$ svn diff my.object | od -c

Upvotes: 2

David W.
David W.

Reputation: 107040

You can use a third party diff program. svn diff has a --diff-cmd parameter that allows you to use a tool such as gvimdiff which is what I use.

I have a rather simple script that takes the parameters SVN passes into third party diff programs, and shows me where the diffs are.

#! /usr/bin/env perl
# mydiff

use strict;
use warnings;

use constant DIFF => qw(mvim -d -f);

my $parameters = $#ARGV;
my $file1 = $ARGV[$parameters - 1];
my $file2 = $ARGV[$parameters];
my $title1 = $ARGV[$parameters - 4];
my $title2 = $ARGV[$parameters - 2];

$ENV{TITLE} = "$title1  -   $title2";
system DIFF, '-c', 'let &titlestring=$TITLE', $file1, $file2;

If I need to use it:

$ svn diff --diff-cmd mydiff

And, I'll see something like this:

enter image description here

You can see line #158 has white space difference. With GVIM, you can also filter out white spaces in the diff too -- just like most diff programs.

Upvotes: 1

Related Questions