Created
August 7, 2017 13:12
-
-
Save mbaldessari/21251767844aa4f7826756a385753888 to your computer and use it in GitHub Desktop.
This file contains 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
function apply_patch() { | |
local CHANGE=$1 | |
local REPO=$2 | |
local DIR=$3 | |
# patchset revision is 4th optional argument | |
if [[ -z ${4-} ]]; then | |
REF=$(curl -s "https://review.openstack.org/changes/?q=change:$CHANGE&o=CURRENT_REVISION" |tail -n+2|jq -r '.[] | .revisions[.current_revision] | .ref') | |
else | |
REF=$(curl -s "https://review.openstack.org/changes/?q=change:$CHANGE&o=ALL_REVISIONS" |tail -n+2| jq -r '.[] | .revisions | to_entries | map(select(.value._number=='$4')) | .[0]|.value.ref') | |
fi | |
echo "Revision for $CHANGE/${4-} -> $REF" | |
pushd $DIR | |
git config --global user.email "michele@acksyn.org" | |
git config --global user.name "Michele Baldessari" | |
git fetch https://git.openstack.org/openstack/$REPO $REF && git cherry-pick FETCH_HEAD | |
popd | |
} | |
# applies review below 4th revision | |
# apply_patch 474486 tripleo-heat-templates tripleo-heat-templates 4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment