build: remove local rebase-pr script (#37055)

Remove the local rebase-pr script with a deprecation message
informing the user to instead perform rebases via ng-dev

PR Close #37055
This commit is contained in:
Joey Perrott 2020-05-15 11:16:19 -07:00 committed by Kara Erickson
parent cc1e0bbdc0
commit 5ac5ac1dec
1 changed files with 4 additions and 42 deletions

View File

@ -1,45 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -u -e -o pipefail # TODO: Remove this deprecation warning after a reasonable period.
BASEDIR=$(dirname "$0") echo "The rebase script has been replaced by the rebase script provided in ng-dev";
echo "To run the rebase via ng-dev run the following command:"
if [ $# -eq 0 ]; then echo " $ yarn -s ng-dev pr rebase <pr-number>"
echo "Rebase github PR onto a branch"
echo
echo "$0 branch_to_rebase_on PR_NUMBER"
echo
exit 0
fi
REBASE_ON="$1"
PR_NO="$2"
HEAD_LABEL=`curl -s https://api.github.com/repos/angular/angular/pulls/$PR_NO | node $BASEDIR/utils/json_extract.js head.label`
echo $HEAD_LABEL
IFS=':' read -r -a array <<< "$HEAD_LABEL"
USER="${array[0]}"
USER_GIT_URL="git@github.com:$USER/angular.git"
BRANCH="${array[1]}"
OLD_BRANCH=`git branch | grep \* | cut -d ' ' -f2`
echo =====================================================
echo Rebasing $USER_GIT_URL branch $BRANCH onto $REBASE_ON
echo =====================================================
git fetch $USER_GIT_URL $BRANCH
git checkout FETCH_HEAD
PUSH_CMD="git push $USER_GIT_URL HEAD:$BRANCH -f";
RESTORE_CMD="git checkout $OLD_BRANCH"
git rebase upstream/master
if [ $? -eq 0 ]; then
$PUSH_CMD
$RESTORE_CMD
else
echo ===========================
echo Git rebase failed. RECOVER WITH:
echo " $PUSH_CMD"
echo " $RESTORE_CMD"
echo ===========================
fi