4 echo "Invalid arguments!"
5 echo "$0 <rNNNNNN | git-hash>"
9 if [ -n "$(git status -uno -s --porcelain)" ]; then
10 echo "You have unstashed changes. Please stash and then revert."
16 OTHER=$(git svn find-rev "$COMMIT")
18 echo "Error! Could not find an svn/git revision for commit $COMMIT!"
22 if [ -n "$(echo $COMMIT | grep '^r[0-9]\+')" ]; then
23 SVN=`echo $COMMIT | sed -e 's/^r//'`
30 # Grab the one line message for our revert commit message.
31 ONE_LINE_MSG=$(git log --oneline $GIT -1 | cut -f2- -d " ")
34 git revert --no-commit $GIT 2>/dev/null
36 echo "Error! Failed to revert commit r$SVN. Resetting to head."
41 # Create a template in our .git directory.
42 TEMPLATE="`git rev-parse --git-dir`/git-svn-revert-template"
44 Revert "$ONE_LINE_MSG"
46 This reverts commit r$SVN.
49 # Begin the commit but give our user an opportunity to edit it.
50 git commit --file="$TEMPLATE" --edit
52 echo "Error! Failed to commit reverting commit for commit r$SVN. Reverting to head."