From 5cfef19a06bf5ade18d7d5f1f0cd699f07279c4a Mon Sep 17 00:00:00 2001 From: Itms Date: Sun, 18 Aug 2019 18:13:04 +0000 Subject: [PATCH] Simplify the translations maintenance script. - Removed bashisms - Removed the call to SVN update which is usually done beforehand in CI - Removed the git alternative which is never used - Fixed the call to poediff which seems to fail with latest poediff Tested on Jenkins since the revamp. Reviewed By: Gallaecio Differential Revision: https://code.wildfiregames.com/D2078 This was SVN commit r22690. --- source/tools/i18n/maintenanceTasks.sh | 37 +++++---------------------- 1 file changed, 6 insertions(+), 31 deletions(-) diff --git a/source/tools/i18n/maintenanceTasks.sh b/source/tools/i18n/maintenanceTasks.sh index 85c117fd74..756abd64a2 100755 --- a/source/tools/i18n/maintenanceTasks.sh +++ b/source/tools/i18n/maintenanceTasks.sh @@ -1,36 +1,11 @@ -#!/bin/bash +#!/bin/sh -# Regenerates the POT files and uploads them to Transifex, downloads the latest -# translations from Transifex, and commits the updated POT and PO files. +# Regenerates the POT files, downloads the latest translations from Transifex, +# and prepares the commit of the updated POT and PO files. SCRIPT_PATH="`dirname \"$0\"`" -# VCS Config ################################################################## - -VCS="svn" -VCS_UPDATE="svn update" -VCS_REVERT="svn revert %s@" -VCS_ADD="svn add %s" -VCS_COMMIT_AND_PUSH="svn commit -m '[i18n] Updated POT and PO files.'" -git rev-parse &> /dev/null -if [[ "$?" = "0" ]]; then - VCS="git" - VCS_UPDATE="git pull --rebase origin master" - VCS_REVERT="git checkout -- %s" - VCS_ADD="git add %s" - VCS_COMMIT_AND_PUSH="git commit -am '[i18n] Updated POT and PO files.' && - git pull --rebase origin master && - git push origin master" -fi - - -# Source Update ############################################################### - -echo ":: Updating sources…" -${VCS_UPDATE} - - # POT Generation ############################################################## echo ":: Regenerating the translation templates…" @@ -54,10 +29,10 @@ python2 "${SCRIPT_PATH}/pullTranslations.py" echo ":: Reverting unnecessary changes…" for FILE_PATH in $(find "${SCRIPT_PATH}/../../../binaries/data" -name "*.pot" -o -name "*.po") do - if [[ ! -n "$(poediff -c ${VCS} -rHEAD -qs "${FILE_PATH}")" ]]; then - $(printf "${VCS_REVERT}" "${FILE_PATH}") + if [ -z "$(poediff -c svn -qs "${FILE_PATH}")" ]; then + svn revert "${FILE_PATH}" else - $(printf "${VCS_ADD}" ${FILE_PATH}) &> /dev/null + svn add "${FILE_PATH}" 2> /dev/null fi done