[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: graphical diff'ing script

From: <kbrannen_at_gte.net>
Date: 2002-12-10 18:36:19 CET

Ulrich Drepper wrote:
> Stepping in out of the blue, but I cannot resist seeing such a
> potentially important part not being writtencorrectly:
>
> -----BEGIN PGP SIGNED MESSAGE-----
...
>>>>[[ $dif = tkdiff ]] && geometry=""
>>>
>>[[ $dif = meld ]] && geometry=""
>
>
> Why the [[ ]] variant instead of plain [ ]? You're not using the
> special features of this code. Besides, you want to write it like this:
>
> case "${dif##*/}" in
> tkdiff|meld) geometry="" ;;
> *) geometry="-geometry 1000x400+0+0" ;;
> esac

Because I come from the ksh world, and [[ ]] is the norm there? :-) OTOH, the
case construct is a good thing; especially if more programs are found that
don't take X Window options (because they aren't X based).

...
>
>
> Replace the following lines
>
>
>>>>last=${file}_LasT
>>>>
>>>>trap "rm -f $last" 2 3 15
>>>>
>>>>svn cat $file > $last 2>/dev/null
>>>>${DIFF:-xxdiff} $geometry $last $file
>>>
>>$dif $geometry $last $file
>>
>>
>>>>rm -f $last
>>>
>
> with
>
> $dif $geometry <(svn cat $file 2>/dev/null) $file
>
>
> No need to create a temporary file which has to be destroyed. And
> especially no need to create it in the working directory. Just imagine
> you want to figure out what changes a coworker of yours changed.

Good thought, but it unfortunately doesn't work for everyone. Some programs
can take STDIN as an arg, others can't, so an actual file is required.
Putting it in the current WD seems as good a place as any, because if there
was an error, it should be pretty obvious what that file is. If you're
concerned about "hitting a real file", change the "_LasT" so something
weirder. :-)

BTW, the "<(svn cat $file 2>/dev/null)" construct does NOT work for me in
either bash or ksh. Bash says: "Error: not an ordinary file or a directory",
and ksh says: "/home/kevin/bin/scripts/svndiff[36]: syntax error: `('
unexpected". Now this does work for some programs:

svn cat $file | $dif $geometry $file -

but as I said, only some (e.g. mgdiff and tkdiff both fail with this as they
can't take a file from STDIN).

Kevin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Dec 10 18:33:15 2002

This is an archived mail posted to the Subversion Dev mailing list.