Skip to content

Instantly share code, notes, and snippets.

Created August 31, 2010 18:24
Show Gist options
  • Save anonymous/559473 to your computer and use it in GitHub Desktop.
Save anonymous/559473 to your computer and use it in GitHub Desktop.
#!/bin/sh
TRUNK_HASH=`git show-ref --hash remotes/trunk`
REV=`git svn find-rev "$TRUNK_HASH"`
git diff --no-prefix $* remotes/trunk |
sed "
# New files have /dev/null as their original path
/^--- \/dev\/null/{
# Read a line into the pattern space
N
# Do a multiline substitution
s/^--- \/dev\/null\n+++ \(.*\)$/--- \1\t(revision 0)\n+++ \1\t (working copy)/
# Jump to the end of the script. This skips the next two substitutions
b end
}
s/^+++ .*/&\t(working copy)/
s/^--- .*/&\t(revision $REV)/
: end
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment