/usr/share/doc/tkcvs/examples/cvsdiff is in tkcvs 8.2.3-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | #!/bin/sh
# Uses gvim to compare CVS versions.
# Written by Phil Brooks and Brent Geske at Mentor Graphics.
# To use with TkCVS, "set cvscfg(tkdiff) cvsdiff"
# Rudimentary arg check:
if [ ! $# -gt 0 ]
then
echo "Usage: $0 [-r revA] [-r revB] file [files ...]"
exit 127
fi
unset REV
unset REVB
CVS=""
if [ -d CVS ]
then
CVS="cvs update -p"
fi
if [ -d .svn ]
then
CVS="svn cat"
fi
if [ "$CVS" = "" ]
then
echo "No CVS or .svn directory. Exiting."
exit 1
fi
if [ "$1" = "-r" ]
then
REV=$2
shift; shift
else
REV="HEAD"
fi
if [ "$1" = "-r" ]
then
REVB=$2
shift; shift
fi
# Presumed env vars:
if [ "$VDIFF" = "" ]
then
VDIFF="gvim -d -f"
fi
if [ "$OS" = "Windows_NT" ]
then
TMP="${SYSTEMDRIVE}/TEMP"
else
TMP="/tmp"
fi
ME=`basename $0`
SCRIPTFILE="${TMP}/${ME}.script.$$"
# Get files
echo "" > $SCRIPTFILE
# loop once to generate diff commands for each file (also spit out some useful info)
for f in $*
do
FILEPATH="$f"
FILEBASE="`basename ${FILEPATH}`"
TMPPATH="${TMP}/${REV}-${FILEBASE}"
TMPPATHB="${TMP}/${REVB}-${FILEBASE}"
if [ ! -r "${FILEPATH}" ]
then
echo "$0: Local File '${FILEPATH}' not found."
continue
fi
if [ "$REVB" != "" ] ; then
echo -n "${REV} vs. ${REVB} ${FILEBASE}..."
else
echo -n "${REV} vs. LOCAL ${FILEBASE}..."
fi
$CVS -r${REV} $FILEPATH > $TMPPATH 2> /dev/null
if [ "$REVB" != "" ] ; then
$CVS -r${REVB} $FILEPATH > $TMPPATHB 2> /dev/null
fi
if [ -s "$TMPPATH" ]
then
if [ "$REVB" != "" ] ; then
if [ -s "$TMPPATHB" ]; then
echo "$VDIFF $TMPPATH $TMPPATHB >/dev/null &" >> $SCRIPTFILE
echo -n " : diffcount ="
diff $TMPPATH $TMPPATHB | grep '^[0-9]' | wc -l
else
echo " :"
echo "$0: CVS revision ${REV} for '${FILEPATH}' not found."
fi
else
echo "$VDIFF $TMPPATH $FILEPATH >/dev/null &" >> $SCRIPTFILE
echo -n " : diffcount ="
diff $TMPPATH $FILEPATH | grep '^[0-9]' | wc -l
fi
else
echo " :"
echo "$0: CVS revision ${REV} for '${FILEPATH}' not found."
fi
done
echo "# wait for all diffs to finish, then cleanup temporaries" >> $SCRIPTFILE
echo "wait" >> $SCRIPTFILE
# loop again for cleanup
for f in $*
do
FILEPATH="$f"
FILEBASE="`basename ${FILEPATH}`"
TMPPATH="${TMP}/${REV}-${FILEBASE}"
TMPPATHB="${TMP}/${REVB}-${FILEBASE}"
# loop for these:
echo "rm -f '$TMPPATH' '$TMPPATHB'" >> $SCRIPTFILE
done
# One last step of non-looped cleanup stuff:
# Can the script remove itself? YES.
echo "rm -f '$SCRIPTFILE'" >> $SCRIPTFILE
# Display files
. $SCRIPTFILE &
|