Skip to content

Instantly share code, notes, and snippets.

@blackjack
Created August 26, 2015 12:34
Show Gist options
  • Save blackjack/2a8186cc19183cd662e1 to your computer and use it in GitHub Desktop.
Save blackjack/2a8186cc19183cd662e1 to your computer and use it in GitHub Desktop.
#!/bin/bash
REALSVN=/usr/bin/svn
ARGS="$@"
if [ "$1" = "commit" -o "$1" = "ci" ]; then
shift # pop off $1 for diff
skip_args=("--help" "-h" "--message" "-m" "--file" "-F")
skip=false
for var in ARGS
do
for item in skip_args
do
if [ "$var" = "$item" ]
then
skip=true
fi
done
done
if [ skip = true ]
then
TEMPLATE=$(mktemp)
$REALSVN diff "$@" > "$TEMPLATE"
$REALSVN $ARGS --editor-cmd="/usr/local/bin/svn-diff-editor '$TEMPLATE'"
else
$REALSVN commit "$@"
fi
else
$REALSVN $ARGS
fi
#!/bin/bash
echo >> "$2"
cat "$1" >> "$2"
rm "$1"
vim "+set ft=diff" "$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment