From a5bef393150fe8ac6a520cb062aea612704f1917 Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Sat, 24 Apr 2010 12:41:39 +0300 Subject: rb-branch: generate a local branch from a review --- rb-branch | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 rb-branch diff --git a/rb-branch b/rb-branch new file mode 100755 index 0000000..804b815 --- /dev/null +++ b/rb-branch @@ -0,0 +1,33 @@ +#!/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" +branch=`grep '^Svn-Branch:' $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" -- cgit v1.2.3