#!/bin/sh error() { me=`basename $0` echo >&2"$me: Error: $*" exit 1 } set -e tmp_patch_file="rb-tmp.diff" svn_branch_prefix="" dir=`dirname $0` rb_patch="$dir/rb-patch" if [ ! -x "$rb_patch" ]; then error "rb-patch exxecutable not available. Tried: $rb_patch." fi $rb_patch "$@" >"$tmp_patch_file" # For the branch name: leave only the final path component branch=`awk '/^Svn-Branch:/ {print $2}' $tmp_patch_file | sed -e 's|.*/||'` svn_branch="${svn_branch_prefix}svn_$branch" review_num=`awk '/^Review:/ {print $2}' $tmp_patch_file` diff_num=`awk '/^Diff:/ {print $2}' $tmp_patch_file` svn_revision=`awk '/^Svn-Revision:/ {print $2}' $tmp_patch_file` # We may need an older version from that branch. # Sadly I don't know how to get that specific revision from git-svn new_branch="$branch-rb-r$review_num-d$diff_num" git checkout -b "$new_branch" "$svn_branch" git am "$tmp_patch_file" rm "$tmp_patch_file"