no need for fetch, handle failed backports

This commit is contained in:
2015-03-30 13:37:55 -07:00
parent f9ffcfa0ed
commit ecca76ea6e

View File

@@ -111,7 +111,15 @@ backport_pr() {
fi
echo Backporting ${PR} to ${BRANCH} from ${REMOTE}
git fetch ${REMOTE} pull/${1}/head:pr/${1}
git checkout ${BRANCH} && curl -s "https://github.com/elastic/kibana/pull/${PR}.patch" | git am
git checkout ${BRANCH} && git pull ${REMOTE} ${BRANCH} && curl -s "https://github.com/elastic/kibana/pull/${PR}.patch" | git am
# if the backport couldn't be cleanly applied, tell the user and exit
if [ $? -ne 0 ]; then
echo "FAILED - Backport could not be cleanly applied!"
echo "FAILED - Fix by hand or run 'git am --abort'"
exit 2
fi
# switch back if we didn't start in the target branch
[ "$THISBRANCH" != "$BRANCH" ] && git checkout -
}