hardcoded python path in garchive and tragesym
[geda-gaf.git] / utils / scripts / schdiff
blobef2a298986c7ca2477de8ceb8f687d5a5dea7f2b
1 #! /bin/sh
3 usage ()
5 cat <<EOF
6 Usage: schdiff old new
8 View a graphical diff of gEDA schematics using gschem and ImageMagick.
10 Usage with git:
11 git difftool -x schdiff ...
13 Usage with Mercurial:
14 Add the following to .hgrc:
16 [extensions]
17 hgext.extdiff =
18 [extdiff]
19 cmd.schdiff = /path/to/schdiff
21 Then use: hg schdiff ...
23 Usage with Subversion:
24 svn diff --diff-cmd schdiff
26 Report bugs to <http://bugs.launchpad.net/geda>
27 gEDA/gaf homepage <http://www.geda-project.org/>
28 EOF
32 for PROG in gschem composite display
34 if which $PROG > /dev/null
35 then
36 true
37 else
38 echo "$PROG is not found. Either it is not installed, or not in your PATH"
39 exit 1
41 done
43 if test $# -lt 2
44 then usage; exit 1
47 #In case the script was invoked with extra option arguments, throw them away
48 shift `expr $# - 2`
50 if test -d $1 -o -d $2
51 then echo "ERROR: schdiff cannot diff entire directories"
52 exit 1
55 LEFTFILE=$1
56 RIGHTFILE=$2
58 GEDASCHEMEDIR=share/gEDA/scheme
59 SCHEMEFILE=`dirname $0`/../${GEDASCHEMEDIR}/schdiff-image.scm
60 LEFTPNG=`mktemp --tmpdir schdiff.XXXXXXXXXX`
61 RIGHTPNG=`mktemp --tmpdir schdiff.XXXXXXXXXX`
62 DIFFPNG=`mktemp --tmpdir schdiff.XXXXXXXXXX`
64 gschem -p -o $LEFTPNG -q -c '(image-size 1344 1008) (image-color "disabled") (gschem-use-rc-values) (gschem-image "dummyfilename") (gschem-exit)' $LEFTFILE && \
65 gschem -p -o $RIGHTPNG -q -c '(image-size 1344 1008) (image-color "disabled") (gschem-use-rc-values) (gschem-image "dummyfilename") (gschem-exit)' $RIGHTFILE && \
66 composite -stereo 0 $LEFTPNG $RIGHTPNG $DIFFPNG && \
67 display $DIFFPNG
68 rm $LEFTPNG
69 rm $RIGHTPNG
70 rm $DIFFPNG