doc/eps2png: Remove version information from this utility
[geda-pcb/pcjc2.git] / tools / pcbdiff
blob00378cd541c1a5be2d3620d97ebf2e24ea08c2b9
1 #! /bin/sh
3 usage ()
5 echo Usage:
6 echo \\tpcbdiff firstfile secondfile
7 echo \\tView a graphical diff of PCB files
8 echo
9 echo \\tTo use with git, just place this script in your PATH and do
10 echo \\tgit difftool -x pcbdiff ...
11 echo
12 echo \\tTo use with mercurial, add the following lines to your .hgrc:
13 echo \\t\\t[extensions]
14 echo \\t\\thgext.extdiff =
15 echo \\t\\t[extdiff]
16 echo \\t\\tcmd.pcbdiff = /PATH/TO/pcbdiff
17 echo \\tthen to invoke it, do
18 echo \\thg pcbdiff ...
19 echo
20 echo \\tTo use with subversion, place it in your PATH and do
21 echo \\tsvn diff --diff-cmd pcbdiff ...
23 echo \\tRequirements: Imagemagick and gschem be installed
27 for PROG in pcb convert composite
29 if which $PROG > /dev/null
30 then
31 true
32 else
33 echo "$PROG is not found. Either it is not installed, or not in your PATH"
34 exit 1
36 done
38 #In case the script was invoked with extra option arguments, throw them away
39 shift `expr $# - 2`
41 if test -d $1 -o -d $2
42 then echo "ERROR: pcbdiff cannot diff entire directories"
43 exit 1
46 LEFTFILE=$1
47 RIGHTFILE=$2
48 LEFTPNG=`mktemp --tmpdir pcbdiff.XXXXXXXXXX`
49 RIGHTPNG=`mktemp --tmpdir pcbdiff.XXXXXXXXXX`
50 LEFTBNW=`mktemp --tmpdir pcbdiff.XXXXXXXXXX`
51 RIGHTBNW=`mktemp --tmpdir pcbdiff.XXXXXXXXXX`
52 DIFFPNG=`mktemp --tmpdir pcbdiff.XXXXXXXXXX`
54 pcb -x png --dpi 200 --only-visible --photo-mode --outfile $LEFTPNG $LEFTFILE
55 pcb -x png --dpi 200 --only-visible --photo-mode --outfile $RIGHTPNG $RIGHTFILE
56 convert -colorspace gray $LEFTPNG $LEFTBNW
57 convert -colorspace gray $RIGHTPNG $RIGHTBNW
58 composite -stereo 0 $LEFTBNW $RIGHTBNW $DIFFPNG
59 display $DIFFPNG
60 rm $LEFTPNG
61 rm $RIGHTPNG
62 rm $LEFTBNW
63 rm $RIGHTBNW
64 rm $DIFFPNG