Post by Daniel ShahafPost by Nathan HartmanSuppose I modified filename.c. Can I revert, but instead of throwing away
my changes, revert to a separate file like filename.c.old and keep my
modified filename.c for comparison in my favorite tool?
but a better way to achieve what you're trying to do is to use a custom diff-cmd.
Right. As an example, here's the "svnbbdiff" script I use (an updated version of the "svntwdiff" script I previously posted), which opens the svn diff into the macOS text editor BBEdit; you could easily change it to open a different editor.
#!/bin/sh
# https://svn.haxx.se/users/archive-2012-04/0090.shtml
set -euo pipefail
PATH="/Applications/BBEdit.app/Contents/Helpers:$PATH"
if [ $# -lt 1 ]; then
echo "usage: $0 <file>"
exit 1
fi
FILE="$1"
if [ ! -f "${FILE}" ]; then
echo "error: ${FILE} doesn't exist"
exit 1
fi
: "${TMPDIR=/tmp}"
svn info -- "${FILE}"@ > /dev/null
TMPFILE=$(mktemp "${TMPDIR}"/svnbbdiff.XXXXXX)
trap 'rm -f -- "${TMPFILE}"' EXIT
svn cat -- "${FILE}"@BASE > "${TMPFILE}"
bbdiff --wait --resume -- "${FILE}" "${TMPFILE}"