Skip to content

Instantly share code, notes, and snippets.

@heckj
Forked from vishvananda/bp.sh
Created March 26, 2012 20:41
Show Gist options
  • Save heckj/2209514 to your computer and use it in GitHub Desktop.
Save heckj/2209514 to your computer and use it in GitHub Desktop.
Script for backporting OpenStack branches to milestone-proposed
#!/usr/bin/env bash
# This is a little script to make backporting patches to milestone proposed.
# Instructions
# ------------
# Make sure that milestone-proposed exists and is up to date:
# git branch -D milestone-proposed
# git checkout -b milestone-proposed origin/milestone-proposed
# Grab the file and stick it in your <project> directory:
# curl -OL https://raw.github.com/gist/2206428/bp.sh
# Make sure the script is runnable:
# chmod 755 bp.sh
# Start backporting reviews:
# ./bp.sh <review_number>
if [ -z "$1" ]; then
echo "Usage: $0 <review_number>"
exit 1
fi
git review -d $1
git checkout milestone-proposed
git pull
git checkout -b bp-$1
git cherry-pick HEAD@{2}
git review milestone-proposed
REMOTE=`git remote show gerrit -n | grep Fetch | cut -d'/' -f3`
PORT=`echo $REMOTE | cut -d':' -f2`
HOST=`echo $REMOTE | cut -d':' -f1`
SHA=`git show-ref HEAD | cut -d' ' -f1`"
echo "Use the following line to approve the review"
echo "ssh -p $PORT $HOST gerrit approve --submit $SHA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment