summaryrefslogtreecommitdiff
path: root/rb-branch
blob: 5df323c96ffd7f82e78ed53b82e1db448d9a6fa6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/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"