Last active
October 2, 2015 07:58
-
-
Save vishvananda/2206428 to your computer and use it in GitHub Desktop.
Script for backporting OpenStack branches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
# git pull | |
# 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 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