summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2019-07-30 09:54:42 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-07-31 13:50:46 +0100
commitf3649983d3c4d0b7b493861e126b6ea62636379b (patch)
tree86a2a2e33ec723647127f0a83382dc866f2566d6 /scripts
parent749d717bc3e6627abf1c606d4b92b162651bdd82 (diff)
downloadpoky-f3649983d3c4d0b7b493861e126b6ea62636379b.tar.gz
scripts/create-pull-request: improve handling of non-SSH remote URLs
When attempting to create a pull request, we look at the remote URL in order to extract information to include in the cover letter. However, the assumption was that the remote is an SSH URL i.e. containing '@' which is not always the case (the pull and push URLs might be different, or we might be pushing via https) - if it wasn't the script just gave up leaving you to manually edit the URLs in the email. With a few minor tweaks to the regexes the script will work for these cases as well. (From OE-Core rev: 675e88e6e0bbd5ab2dcd4bdf97b0de59925a1be6) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/create-pull-request20
1 files changed, 6 insertions, 14 deletions
diff --git a/scripts/create-pull-request b/scripts/create-pull-request
index 3ce03d6c1a..762828fd9a 100755
--- a/scripts/create-pull-request
+++ b/scripts/create-pull-request
@@ -123,20 +123,12 @@ fi
123 123
124# Rewrite private URLs to public URLs 124# Rewrite private URLs to public URLs
125# Determine the repository name for use in the WEB_URL later 125# Determine the repository name for use in the WEB_URL later
126case "$REMOTE_URL" in 126USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_.@-]*\$\?"
127*@*) 127PROTO_RE="[a-z][a-z+]*://"
128 USER_RE="[A-Za-z0-9_.@][A-Za-z0-9_.@-]*\$\?" 128GIT_RE="\(^\($PROTO_RE\)\?\)\($USER_RE@\)\?\([^:/]*\)[:/]\(.*\)"
129 PROTO_RE="[a-z][a-z+]*://" 129REMOTE_URL=${REMOTE_URL%.git}
130 GIT_RE="\(^\($PROTO_RE\)\?$USER_RE@\)\([^:/]*\)[:/]\(.*\)" 130REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\5#")
131 REMOTE_URL=${REMOTE_URL%.git} 131REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\4/\5#")
132 REMOTE_REPO=$(echo $REMOTE_URL | sed "s#$GIT_RE#\4#")
133 REMOTE_URL=$(echo $REMOTE_URL | sed "s#$GIT_RE#git://\3/\4#")
134 ;;
135*)
136 echo "WARNING: Unrecognized remote URL: $REMOTE_URL"
137 echo " The pull and browse URLs will likely be incorrect"
138 ;;
139esac
140 132
141if [ -z "$BRANCH" ]; then 133if [ -z "$BRANCH" ]; then
142 BRANCH=$(git branch | grep -e "^\* " | cut -d' ' -f2) 134 BRANCH=$(git branch | grep -e "^\* " | cut -d' ' -f2)