Skip to content

Instantly share code, notes, and snippets.

@siddhesh
Created September 15, 2021 12:20
Show Gist options
  • Save siddhesh/b7be0970d8a70e5d68c36f3957ae19a4 to your computer and use it in GitHub Desktop.
Save siddhesh/b7be0970d8a70e5d68c36f3957ae19a4 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Run this from within the repo. Tested with glibc.
# This is what I have in my glibc git-config
#
# [pw]
# server = https://patchwork.sourceware.org/api/1.2/
# project = glibc
# username = <my username>
# password = <my password>
# states = committed,accepted,superseded,deferred,rejected
# Set this to your patchwork repo path
PWROOT=$HOME/src/upstream/patchwork
STATES="--state accepted --state new --state under-review"
STATES="$STATES --state changes-requested"
STATES="$STATES --state committed"
git remote update
git log --pretty=oneline master..origin/master | awk '{print $1}' |
while read gh; do
h=$(git diff $gh~1..$gh | python $PWROOT/patchwork/hasher.py)
pwid=$(git-pw patch list --hash $h $STATES -f simple --column ID | grep -v -e ID -e "\--")
if [ -n "$pwid" ]; then
echo "$(git log --pretty=oneline $gh~1..$gh): OK"
git-pw patch update --commit-ref $gh --state committed $pwid
else
echo "$(git log --pretty=oneline $gh~1..$gh): MISSING"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment