releasing: Add a script to help cut release branches
Change-Id: I83f102491530fcb33cac2dc9f44a2919f0862829
diff --git a/checkout-release.sh b/checkout-release.sh
new file mode 100755
index 0000000..718d798
--- /dev/null
+++ b/checkout-release.sh
@@ -0,0 +1,50 @@
+#!/bin/bash -e
+
+function usage {
+ echo "Usage: checkout-release.sh <release-file> <release-branch-name>"
+ echo
+ echo "Where <release-file> contains a simple list of project path"
+ echo "to SHA-1 commit ID."
+ echo
+ exit 1
+}
+
+release_file="$1"
+release_branch_name="$2"
+
+[[ ! -e $release_file ]] && usage
+[[ -z $release_branch_name ]] && usage
+
+(
+ while read project commit; do
+ pushd $project
+ git checkout $commit
+ git branch -D --force $release_branch_name
+ git checkout -b $release_branch_name
+ popd
+ done
+) < $release_file
+
+echo
+echo "**********************************************************************"
+echo "Everything look sane? If so, type YES to push the branches upstream."
+read yes
+
+if [[ "$yes" != "YES" ]]; then
+ echo "You didn't say YES. Cowardly refusing to continue."
+ echo "**********************************************************************"
+ echo
+ exit 1
+fi
+
+(
+ while read project commit; do
+ pushd $project
+ git push aiy $release_branch_name:refs/heads/$release_branch_name
+ popd
+ done
+) < $release_file
+
+echo "Push completed."
+echo "**********************************************************************"
+echo