Don't re-propose translation changes that already exist.

Previously Gerrit would reject changes that were basically duplicates.
So when we submitted a duplicate translation change it would not get
accepted. The new version of Gerrit now accepts these duplicates which
causes an excessive amount of patches to be posted.

Change the behavior so that know it will only propose a translation
change when there is an actual change compared to previous proposed
patches.

Change-Id: I1d94852265ba5898f7c0fd312221df7c469a5a25
This commit is contained in:
John L. Villalovos 2017-11-15 13:54:16 -08:00
parent 0f2c4cd9b7
commit 1f990ebba9
2 changed files with 33 additions and 9 deletions

View File

@ -321,15 +321,20 @@ function send_patch {
git commit -F- <<EOF
$COMMIT_MSG
EOF
# Do error checking manually to ignore one class of failure.
set +e
# We cannot rely on the default branch in .gitreview being
# correct so we are very explicit here.
output=$(git review -t $TOPIC $branch)
ret=$?
[[ "$ret" -eq 0 || "$output" =~ "No changes between prior commit" ]]
success=$?
set -e
CUR_PATCH_ID=$(git show | git patch-id | awk '{print $1}')
# Don't submit if we have the same patch id of previously submitted
# patchset
if [[ "${PREV_PATCH_ID}" != "${CUR_PATCH_ID}" ]]; then
# Do error checking manually to ignore one class of failure.
set +e
# We cannot rely on the default branch in .gitreview being
# correct so we are very explicit here.
output=$(git review -t $TOPIC $branch)
ret=$?
[[ "$ret" -eq 0 || "$output" =~ "No changes between prior commit" ]]
success=$?
set -e
fi
fi
return $success
}

View File

@ -262,8 +262,27 @@ function propose_reactjs {
setup_git
# Check whether a review already exists, setup review commit message.
# Function setup_review calls setup_commit_message which will set CHANGE_ID and
# CHANGE_NUM if a change exists and will always set COMMIT_MSG.
setup_review "$BRANCH"
# If a change already exists, let's pull it in and compute the
# 'git patch-id' of it.
PREV_PATCH_ID=""
if [[ -n ${CHANGE_NUM} ]]; then
# Ignore errors we get in case we can't download the patch with
# git-review. If that happens then we will submit a new patch.
set +e
git review -d ${CHANGE_NUM}
RET=$?
if [[ "$RET" -eq 0 ]]; then
PREV_PATCH_ID=$(git show | git patch-id | awk '{print $1}')
fi
set -e
# The git review changed our branch, go back to our correct branch
git checkout -f ${BRANCH}
fi
# Setup venv - needed for all projects for subunit
setup_venv