Merge "Check cherry-pick hashes in pep8 tox target"

This commit is contained in:
Zuul 2020-06-15 22:32:33 +00:00 committed by Gerrit Code Review
commit 1490a54fa9
2 changed files with 33 additions and 0 deletions

32
tools/check-cherry-picks.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
#
# A tool to check the cherry-pick hashes from the current git commit message
# to verify that they're all on either master or stable/ branches
#
hashes=$(git show --format='%b' --quiet $1 | sed -nr 's/^.cherry picked from commit (.*).$/\1/p')
checked=0
branches+=""
for hash in $hashes; do
branch=$(git branch -a --contains "$hash" 2>/dev/null| grep -oE '(master|stable/[a-z]+)')
if [ $? -ne 0 ]; then
echo "Cherry pick hash $hash not on any master or stable branches"
exit 1
fi
branches+=" $branch"
checked=$(($checked + 1))
done
if [ $checked -eq 0 ]; then
if ! grep -q '^defaultbranch=stable/' .gitreview; then
echo "Checked $checked cherry-pick hashes: OK"
exit 0
else
if ! git show --format='%B' --quiet | grep -qi 'stable.*only'; then
echo 'Stable branch requires either cherry-pick -x headers or [stable-only] tag!'
exit 1
fi
fi
else
echo Checked $checked cherry-pick hashes on branches: $(echo $branches | tr ' ' '\n' | sort | uniq)
fi

View File

@ -56,6 +56,7 @@ commands =
bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'" bash -c "! find doc/ -type f -name *.json | xargs grep -U -n $'\r'"
# Check that all included JSON files are valid JSON # Check that all included JSON files are valid JSON
bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python' bash -c '! find doc/ -type f -name *.json | xargs -t -n1 python -m json.tool 2>&1 > /dev/null | grep -B1 -v ^python'
bash tools/check-cherry-picks.sh
[testenv:fast8] [testenv:fast8]
description = description =