views:

28

answers:

2

Is there way in svn diff or any other tool(linux based) to show only whitespace/tabs changes ?.

Purpose, I dont want those diffs to be checked in. I can put back those lines to same state before check in if a tool could catch those diffs.

Thanks,

A: 

Beyond Compare will show those highlighted in a different color depending on the type of file. they do have a Linux version, but I have not used it. It is a great diff tool though.

Moose
Thanks Moose. I'm looking for a tool which can be run from command line.. I want to make script based on that which will say if my touched files has "only white spaces changes" on somelines, so dont commit..
Xprog
+1  A: 

This should work for you.

#!/bin/bash

FILES=`svn status | awk '{ print $2}'`
for file in $FILES
do
    COUNT=`svn diff $file --diff-cmd 'diff' -x '-w' | wc -l`
    if [ $COUNT -le 2 ]
    then
       echo "$file has only whitespace changes"
    fi
done

Also, instead of putting lines back to the same state, why not just revert those files?

mfisch
Thanks mfisch... Sorry if my question wasn't clear at first place. Your answer is almost correct. I want see if any file has lines which has only whitespaces changes. (not the entire file)..FILES=`svn status | awk '{ print $2}'`for file in $FILESdo COUNT1=`svn diff $file --diff-cmd 'diff' -x '-w' | wc -l` COUNT2=`svn diff $file --diff-cmd 'diff' | wc -l` if [ ! $COUNT1 = $COUNT2 ] then echo "$file has whitespace changes" fidone
Xprog