1 | #!/usr/bin/perl |
---|
2 | # ------------------------------------------------------------------------------ |
---|
3 | # NAME |
---|
4 | # fcm_xxdiff_wrapper |
---|
5 | # |
---|
6 | # SYNOPSIS |
---|
7 | # fcm_xxdiff_wrapper ARGS |
---|
8 | # |
---|
9 | # DESCRIPTION |
---|
10 | # Wrapper script which allows "xxdiff" to be invoked by the "svn diff" |
---|
11 | # command. It is used in combination with the "--diff-cmd" option to |
---|
12 | # "svn diff". The arguments supplied by "svn diff" are as follows: |
---|
13 | # -u -L OLD_FILE_DESC -L NEW_FILE_DESC OLD_FILE_NAME NEW_FILE_NAME |
---|
14 | # |
---|
15 | # COPYRIGHT |
---|
16 | # (C) Crown copyright Met Office. All rights reserved. |
---|
17 | # For further details please refer to the file COPYRIGHT.txt |
---|
18 | # which you should have received as part of this distribution. |
---|
19 | # ------------------------------------------------------------------------------ |
---|
20 | |
---|
21 | # Standard pragmas: |
---|
22 | use warnings; |
---|
23 | use strict; |
---|
24 | |
---|
25 | # ------------------------------------------------------------------------------ |
---|
26 | |
---|
27 | if ($ARGV[0] ne "-u" or $ARGV[1] ne "-L" or $ARGV[3] ne "-L") { |
---|
28 | die "Unexpected argument"; |
---|
29 | } |
---|
30 | |
---|
31 | # Check existence of files |
---|
32 | die $ARGV[5], ': not found, abort' if not -f $ARGV[5]; |
---|
33 | die $ARGV[6], ': not found, abort' if not -f $ARGV[6]; |
---|
34 | |
---|
35 | if ($ARGV[5] =~ m#.svn/empty-file$#) { |
---|
36 | print "Skipping new file\n"; |
---|
37 | |
---|
38 | } elsif ($ARGV[6] =~ m#.svn/empty-file$#) { |
---|
39 | print "Skipping deleted file\n"; |
---|
40 | |
---|
41 | } elsif (-B $ARGV[6]) { |
---|
42 | print "Skipping binary file\n"; |
---|
43 | |
---|
44 | } else { |
---|
45 | print "Comparing '$ARGV[2]' with '$ARGV[4]'\n"; |
---|
46 | exec "xxdiff --title1 '$ARGV[2]' --title2 '$ARGV[4]' $ARGV[5] $ARGV[6]"; |
---|
47 | } |
---|
48 | |
---|
49 | __END__ |
---|