You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2025/05/30 14:46:14 UTC

svn commit: r1925985 - /httpd/dev-tools/trunk/github/create_pr.sh

Author: covener
Date: Fri May 30 14:46:14 2025
New Revision: 1925985

URL: http://svn.apache.org/viewvc?rev=1925985&view=rev
Log:
minor improvements

- bail out if `gh auth` shows no login
- allow -r to resume if there are cherry-pick conflicts


Modified:
    httpd/dev-tools/trunk/github/create_pr.sh

Modified: httpd/dev-tools/trunk/github/create_pr.sh
URL: http://svn.apache.org/viewvc/httpd/dev-tools/trunk/github/create_pr.sh?rev=1925985&r1=1925984&r2=1925985&view=diff
==============================================================================
--- httpd/dev-tools/trunk/github/create_pr.sh (original)
+++ httpd/dev-tools/trunk/github/create_pr.sh Fri May 30 14:46:14 2025
@@ -15,13 +15,23 @@
 
 usage()
 {
-    echo "usage: $(basename $0) [-b branch name] [-t target branch name] <revision number> [revision numbers] ..."
+    echo "usage: $(basename $0) [-r] [-b branch name] [-t target branch name] <revision number> [revision numbers] ..."
+    echo "\t\t -r: resume after handling merge conflicts from a previous run"
     exit
 }
 
 TARGET_BRANCH_NAME="2.4.x"
+RESUME=0
 
-while getopts "hb:t:" OPTION ; do
+if type -P gh > /dev/null ; then
+    if ! gh auth status 2>&1|grep "Logged in to github.com" >/dev/null; then
+        echo "You need to `gh auth login` before continuing"
+        exit 1
+    fi
+fi
+
+exit 2
+while getopts "hb:t:r" OPTION ; do
     case "$OPTION" in
         h) usage
            ;;
@@ -29,6 +39,8 @@ while getopts "hb:t:" OPTION ; do
            ;;
         t) TARGET_BRANCH_NAME="$OPTARG"
            ;;
+        r) RESUME=1
+           ;;
     esac
 done
 shift $((OPTIND - 1))
@@ -74,12 +86,14 @@ for i in "$@" ; do
     fi
 done
 
-for i in $COMMITS ; do
-    git cherry-pick -x $i
-    if [ "$?" -ne 0 ] ; then
-        exit
-    fi
-done
+if [ $RESUME -eq 0 ]; then
+  for i in $COMMITS ; do
+      git cherry-pick -x $i
+      if [ "$?" -ne 0 ] ; then
+          exit
+      fi
+  done
+fi
 
 git push -u origin $BRANCH_NAME
 MESSAGE=`echo "$@" | sed -e 's/ /, r/g'`