# Takes a list of Gerrit patches and fetches all projects and cherry-pick
# patches for projects. The trigger is
# 'recheck: SPACE_SEPERATED_LIST_OF_PATCHES'
+# or
+# 'reverify: SPACE_SEPERATED_LIST_OF_PATCHES'
#
# NOTE: This script assumes the user will provide the correct dependency order
# via the PATCHES list.
REPOS_DIR="$WORKSPACE/.repos"
-IFS=" " read -r -a PATCHES <<< "$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep 'recheck:' | awk -F: '{print $2}')"
+IFS=" " read -r -a PATCHES <<< "$(echo "$GERRIT_EVENT_COMMENT_TEXT" | grep -E '(recheck:|reverify:)' | awk -F: '{print $2}')"
# Workaround for git-review bug in v1.24
# https://storyboard.openstack.org/#!/story/2001081
virtualenv --quiet "/tmp/v/git-review"
# shellcheck source=/tmp/v/git-review/bin/activate disable=SC1091
source "/tmp/v/git-review/bin/activate"
-pip install --quiet --upgrade pip
+pip install --quiet --upgrade "pip==9.0.3" setuptools
pip install --quiet --upgrade git-review
set -u
# End git-review workaround
project=$(echo "$json" | jq -r '.project')
branch=$(echo "$json" | jq -r '.branch')
+ if [ "$GERRIT_CHANGE_NUMBER" == "$patch" ]; then
+ echo "WARN: GERRIT_CHANGE and $patch are one and the same. Ignoring patch..."
+ continue
+ fi
+
if [ ! -d "$REPOS_DIR/$project" ]; then
git clone -q --depth 1 -b "$branch" "$GIT_URL/$project" "$REPOS_DIR/$project"