#!/bin/sh # # This script calls meld instead of ccrc_xcleardiff # replace ccrc_xcleardiff in your /plugins/com.ibm.rational.clearcase.compare_merge.linux_ directory with this file to run meld instead # of running the CCRC version # MELD=/usr/bin/meld usage() { cat 1>&2 < This will backup the original clearcase diff tool and replace it with this script that uses meld. To uninstall, use the comment $0 --uninstall MORE INFO The clearcase remote client executes the file: /plugins/com.ibm.rational.clearcase.compare_merge.linux_*/ccrc_xcleardiff with various numbers of arguments to execute its diff and merge tool. To execute a diff, the CCRC calls ccrc_xcleardiff with various numbers of arguments. When its trying to do a diff, it passes 6 arguments: 1 - "-fname" 2 - The label (description) of the original file 3 - "-fname" 4 - the label (description) of the new file 5 - the file with the contents of the original file 6 - the file with the contents of the new file When called in merge mode, CCRC calls ccrc_xcleardiff with the following 12 arguments: 1 - "-fname" 2 - The label (description) of the base file 3 - "-fname" 4 - the label (description) of the first new file (new in CC) 5 - "-fname" 6 - the label (description) of the second new file (local file) 7 - "-out" 8 - The output file to save (which is the same as #12) 9 - "-base" 10 - the file with the contents of the base file 11 - the file with the contents of the first new file (new in CC file) 12 - the file with the contents of the second new file (local file) By calling --install on this script, the script backs up the original ccrc_xcleardiff for all installed ccrc plugins in the specified eclipse directory to ccrc_xcleardiff.orig and then makes link to itself as the new ccrc_xcleardiff. Any time that the CCRC needs to call a merge or diff, it ends up calling this script, which in turn invokes meld. Calling --uninstall reverses this process EOF } install() { if [ -x "$0" ] ; then script="$0" else script="${PWD}/$0" fi directory="$1" if [ ! -d "$1" ] ; then echo "Can't find eclipse directory $1" 1>&2 usage exit 1 fi filecmd="ls ${directory}/plugins/com.ibm.rational.clearcase.compare_merge.linux_*/ccrc_xcleardiff" if $filecmd > /dev/null ; then test #noop else echo "No CCRC installations found under $1" 1>&2 usage exit 1 fi for file in `$filecmd` ; do echo "Installing to $file" cp $file $file.orig rm $file ln -s $script $file done } uninstall() { if [ -x "$0" ] ; then script="$0" else script="${PWD}/$0" fi directory="$1" if [ ! -d "$1" ] ; then echo "Can't find eclipse directory $1" 1>&2 usage exit 1 fi filecmd="ls ${directory}/plugins/com.ibm.rational.clearcase.compare_merge.linux_*/ccrc_xcleardiff" if $filecmd > /dev/null ; then test #noop else echo "No CCRC installations found under $1" 1>&2 usage exit 1 fi for file in `$filecmd` ; do if [ ! -x $file.orig ] ; then echo "Didn't find backup file $file.orig, skipping" else echo "Restoring $file" rm $file cp $file.orig $file rm $file.orig fi done } if [ "$1" = "--usage" ] ; then usage exit 0 elif [ "$1" = "--install" ] ; then install $2 exit 0 elif [ "$1" = "--uninstall" ] ; then uninstall $2 exit 0 elif [ "$#" = "0" ] ; then usage exit 1 fi if [ $# = 6 ] ; then # 2 way #echo $MELD $5 --label $2 $6 --label $4 >> /tmp/ccrc_diff $MELD "$5" --label "$2" "$6" --label "$4" elif [ $# = 12 ] ; then #3 way $MELD "$10" "$8" "$11" # $8 is the out / local # $10 is the base # $11 is the checked in one else # use the original one, cause we have no idea what its trying to do $0.orig $* fi exit 0