Skip to content

Instantly share code, notes, and snippets.

@goodell
Created January 19, 2016 22:46
Show Gist options
  • Save goodell/d837a554775bb19f760f to your computer and use it in GitHub Desktop.
Save goodell/d837a554775bb19f760f to your computer and use it in GitHub Desktop.
#!/bin/zsh
# see this output:
# $ svn diff --diff-cmd showargs sa/src/palo/include/sereno/sereno_defs.h
# Index: sa/src/palo/include/sereno/sereno_defs.h
# ===================================================================
# $#=7
# $1=|-u|
# $2=|-L|
# $3=|sa/src/palo/include/sereno/sereno_defs.h (revision 258787)|
# $4=|-L|
# $5=|sa/src/palo/include/sereno/sereno_defs.h (working copy)|
# $6=|/home/dgoodell/svn/bodega-dev/.svn/pristine/50/50a9914f087cd2f4758d878df14e15901d04a096.svn-base|
# $7=|/tmp/svn-vQYxuP|
PRETTY_LEFT="$3"
PRETTY_RIGHT="$5"
LEFT="$6"
RIGHT="$7"
if (( $FORCE_COLOR )) || [[ -t 1 ]] ; then
COLOR_ARG='--color=always'
else
COLOR_ARG='--color=never'
fi
git --no-pager diff $COLOR_ARG --no-index --patience "$LEFT" "$RIGHT" | \
perl -p -e "s{\Q--- a$LEFT\E}{--- a/$PRETTY_LEFT}; s{\Q+++ b$RIGHT\E}{+++ b/$PRETTY_RIGHT};"
@goodell
Copy link
Author

goodell commented Jan 19, 2016

Rename this script to svn-patiencediff, make it executable, then in your ~/.subversion/config, set this:

[helpers]
diff-cmd = svn-patiencediff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment