Skip to content

Instantly share code, notes, and snippets.

@gogomako
Forked from neosergio/gitdiff-svnpatch.sh
Last active June 1, 2016 06:17
Show Gist options
  • Save gogomako/94213ea73f9bf64f127273bf4ee17c33 to your computer and use it in GitHub Desktop.
Save gogomako/94213ea73f9bf64f127273bf4ee17c33 to your computer and use it in GitHub Desktop.
Converts git diff to svn patch format and acceptable for reviewboard 2.0.23
TAB=$'\t'
#get svn revision from manually input
SVN_DIFF_REV=$1
git diff --no-prefix --ignore-space-at-eol | sed -e "s/^diff --git [^[:space:]]*/Index:/" -e "s/^index.*/===================================================================/" -e "/^---/s/$/${TAB}(revision ${SVN_DIFF_REV})/" | awk '{if($1!="+++") print ; else print $1" "$2"\t(working copy)"}' | sed -e "/\/dev\/null/s/[0-9]*)$/0)/" > changes.patch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment