#!/usr/bin/env perl # wdiff wrapper to be used as a "svn --diff-cmd" command. # Copyright 2012 Vincent Lefevre . # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA use strict; my @cmd = split / +/, "wdiff -n -w \033[30;41m -x \033[0m -y \033[30;42m -z \033[0m"; my @f = qw(--- +++); my $lopt; foreach my $arg (@ARGV) { if ($lopt) { my $p = shift @f; defined $p or $! = 2, die "$0: too many -L options\n"; print "$p $arg\n"; undef $lopt; next; } $arg eq '-u' and next; $arg eq '-L' and $lopt = 1, next; push @cmd, $arg; } exec @cmd; # $Id: swdiff 54259 2012-08-17 15:53:35Z vinc17/xvii $