On Wed, 5 Apr 2023 22:13:26 -0700 Alexei Starovoitov wrote: > On Wed, Apr 5, 2023 at 11:19 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > > > > On Wed, 5 Apr 2023 10:22:16 -0700 Andrii Nakryiko wrote: > > > So I'm exclusively using `pw-apply -c <patchworks-url>` to apply > > > everything locally. > > > > I think you can throw -M after -c $url? It can only help... :) > > Yeah. If only... > I'm exclusively using -c. > -M only works with -s, but I couldn't make -s -M work either. > Do you pass the series as a number? Yes, it copy just the numerical ID into the terminal. > but then series_json=$(curl -s $srv/series/$1/) line > doesn't look right, since it's missing "/mbox/" ? That's loading JSON from the patchwork's REST API. > User error on my side, I guess. > My bash skills were too weak to make -c and -M work, > but .git/hooks tip is great! > Thank you. FWIW I think the below may work for using -c instead of -s. But it is mixing "Daniel paths" and "Jakub paths" in the script. The output is still a bit different than when using -s. diff --git a/pw-apply b/pw-apply index 5fc37a24b027..c9cec94a4a8c 100755 --- a/pw-apply +++ b/pw-apply @@ -81,17 +81,15 @@ accept_series() } cover_from_url() { curl -s $1 | gunzip -f -c > tmp.i - series_num=`grep "href=\"/series" tmp.i|cut -d/ -f3|head -1` + series=`grep "href=\"/series" tmp.i|cut -d/ -f3|head -1` cover_url=`grep "href=\"/project/netdevbpf/cover" tmp.i|cut -d\" -f2` if [ ! -z "$cover_url" ]; then - curl -s https://patchwork.kernel.org${cover_url}mbox/ | gunzip -f -c > cover.i merge="1" fi - curl -s https://patchwork.kernel.org/series/$series_num/mbox/ | gunzip -f -c > mbox.i } edits="" am_flags="" branch="mbox" @@ -118,18 +116,20 @@ while true; do -h | --help ) usage; break ;; -- ) shift; break ;; * ) break ;; esac done +# Load the info from cover first, it may will populate $series and $merge +[ ! -z "$cover" ] && cover_from_url $cover + [ ! -z "$auto_branch" ] && [ -z "$series" ] && usage [ ! -z "$mbox" ] && [ ! -z "$series" ] && usage [ -z "$mbox" ] && [ -z "$series" ] && [ -z "$cover" ] && usage [ ! -z "$accept" ] && [ ! -z "$mbox" ] && usage [ ! -z "$series" ] && mbox_from_series $series [ ! -z "$mbox" ] && mbox_from_url $mbox [ ! -z "$accept" ] && accept_series $series -[ ! -z "$cover" ] && cover_from_url $cover target=$(git branch --show-current) body= author=XYZ