aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2021-02-08 18:42:09 -0800
committerDaniel Borkmann <daniel@iogearbox.net>2021-02-24 17:55:21 +0100
commitd2e02c2c8701f3ccc567c3b97fb0cb311b58fb33 (patch)
tree4b4104f9f457bf218d53b35073ec9a280a4177b9
parent0633ac5d5369580c6d9c366aa70fbfd0c61f42a7 (diff)
downloadpw-d2e02c2c8701f3ccc567c3b97fb0cb311b58fb33.tar.gz
pw-pull: allow setting pull URL explicitly
For cases where patchwork got completely confused allow specifying pull URL on the command line. Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
-rw-r--r--README3
-rwxr-xr-xpw-pull21
2 files changed, 16 insertions, 8 deletions
diff --git a/README b/README
index d56677d..e97bdb9 100644
--- a/README
+++ b/README
@@ -235,6 +235,9 @@ at all, using -c (AKA --pull-from-cover):
$ pw-pull -s 12345 -c
+Last but not least it can pull from an explicit URL with -P which can be
+useful as well (it will at least provide the merge commit template).
+
I don't mark as applied from the command line (yet) because I double
check the tests passed in the UI, anyway.
diff --git a/pw-pull b/pw-pull
index e0bd966..4d25883 100755
--- a/pw-pull
+++ b/pw-pull
@@ -14,12 +14,13 @@ source $(dirname $0)/lib.sh
usage()
{
cat <<-EOF
- usage: pw-pull [-p PULL] [-s SERIES] [-c] [-h]
+ usage: pw-pull [-p PULL] [-s SERIES] [-c] [-P PULL_URL] [-h]
EOF
exit
}
pull=""
+pull_url=""
cover=""
series=""
series_branch="tmp"
@@ -29,13 +30,15 @@ while true; do
-p | --pull ) pull="$2"; shift 2 ;;
-s | --series ) series="$2"; shift 2 ;;
-c | --pull-from-cover ) cover="y"; shift ;;
+ -P | --pull-url ) pull_url="$2"; shift 2 ;;
-h | --help ) usage; break ;;
-- ) shift; break ;;
* ) break ;;
esac
done
-[ -z "$pull" ] && [ -z "$cover" ] && usage
-[ ! -z "$pull" ] && [ ! -z "$cover" ] && usage
+[ -z "$pull" ] && [ -z "$cover" ] && usage
+[ ! -z "$pull" ] && [ ! -z "$cover" ] && usage
+[ ! -z "$pull" ] && [ ! -z "$pull_url" ] && usage
srv=$(git config --get pw.server)
srv=${srv%/} # strip trailing slash
@@ -69,11 +72,13 @@ elif [ ! -z "$cover" ]; then
/^Please consider/ {e=1}
{if(!e) print}')
- pull_url=$(echo "$cover_json" |
- jq -r '.content' |
- awk '/^.+$/ { if (n) {n=0; print} }
- /and are available in the git repository at:/ {n=1}')
- pull_url=$(echo $pull_url)
+ if [ -z "$pull_url" ]; then
+ pull_url=$(echo "$cover_json" |
+ jq -r '.content' |
+ awk '/^.+$/ { if (n) {n=0; print} }
+ /and are available in the git repository at:/ {n=1}')
+ pull_url=$(echo $pull_url)
+ fi
if [ -z "$pull_url" ]; then
echo "Unable to parse out pull URL"