@@ -13,6 +13,7 @@ Option style arguments:
1313--web Merge a web PR (rather than openssl PR)
1414--perftools Merge a perftools PR (rather than openssl PR)
1515--fuzz-corpora Merge a PR against fuzz-corpora (rather than openssl PR)
16+ --security Merge a PR in the security repo
1617--remote <remote> Repo to merge with (rather than git.openssl.org), usually 'upstream'
1718--target <branch> Merge target (rather than current branch), usually 'master'
1819--ref <branch> A synonym for --target
@@ -86,6 +87,9 @@ while [ $# -ne 0 ]; do
8687 --fuzz-corpora)
8788 WHAT=fuzz-corpora ; BUILD=no ; shift
8889 ;;
90+ --security)
91+ WHAT=security ; REMOTESRVR=" github.com" ; shift
92+ ;;
8993 --cherry-pick)
9094 shift ;
9195 PICK=1;
@@ -167,10 +171,18 @@ if [ "$PRNUM" = "" -o "$TEAM" = "" ] ; then
167171fi
168172
169173PR_URL_CONTENTS=$( mktemp /tmp/gh.XXXXXX)
170- PR_URL=https://api.github.com/repos/openssl/$WHAT /pulls/$PRNUM
171- if ! wget --quiet $PR_URL -O $PR_URL_CONTENTS ; then
172- echo " Error getting $PR_URL "
173- exit 1
174+ PR_API=repos/openssl/$WHAT /pulls/$PRNUM
175+ PR_URL=https://api.github.com/$PR_API
176+ if which gh > /dev/null 2>&1 ; then
177+ if ! gh api $PR_API > $PR_URL_CONTENTS ; then
178+ echo " Error getting $PR_API "
179+ exit 1
180+ fi
181+ else
182+ if ! wget --quiet $PR_URL -O $PR_URL_CONTENTS ; then
183+ echo " Error getting $PR_URL "
184+ exit 1
185+ fi
174186fi
175187
176188set -- $( jq -r ' [.head.user.login, .head.ref, .head.repo.ssh_url] | join(" ")' $PR_URL_CONTENTS )
@@ -269,6 +281,10 @@ echo
269281echo Diff against $REMOTE /$TARGET :
270282git diff $REMOTE /$TARGET
271283
284+ if [ " $WHAT " != " security" ] ; then
285+ ADDPR=" --prnum=$PRNUM "
286+ fi
287+
272288if [ " $INTERACTIVE " == " yes" ] ; then
273289 echo
274290 echo -n " Press Enter to interactively rebase $AUTOSQUASH on $REMOTE /$TARGET : " ; read foo
@@ -280,8 +296,8 @@ if [ "$INTERACTIVE" == "yes" ] ; then
280296 fi
281297 REBASING=
282298 echo
283- echo " Calling addrev $ADDREVOPTS --prnum= $PRNUM $TEAM $REMOTE /$TARGET .."
284- addrev $ADDREVOPTS --prnum= $PRNUM $TEAM $REMOTE /$TARGET ..
299+ echo " Calling addrev $ADDREVOPTS $ADDPR $TEAM $REMOTE /$TARGET .."
300+ addrev $ADDREVOPTS $ADDPR $TEAM $REMOTE /$TARGET ..
285301fi
286302
287303git checkout $TARGET
@@ -292,7 +308,7 @@ if [ "$INTERACTIVE" != "yes" ] ; then
292308 git merge --ff-only --no-commit --squash $WORK
293309 AUTHOR=` git show --no-patch --pretty=" format:%an <%ae>" $WORK `
294310 git commit --author=" $AUTHOR "
295- addrev $ADDREVOPTS --prnum= $PRNUM $TEAM $REMOTE /${TARGET} ..
311+ addrev $ADDREVOPTS $ADDPR $TEAM $REMOTE /${TARGET} ..
296312else
297313 # echo -n "Press Enter to merge to $TARGET: "; read foo
298314 echo
0 commit comments