diff options
-rwxr-xr-x | scripts/unfuzzy-xml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/unfuzzy-xml b/scripts/unfuzzy-xml new file mode 100755 index 000000000..314320a85 --- /dev/null +++ b/scripts/unfuzzy-xml @@ -0,0 +1,36 @@ +#! /bin/bash + +# This script can be used to update the revision comment in translations +# after an update in an English original. Result is that translators won't +# need to check changes. +# This script is intended only for use by people working on the original +# English text and then only if they know exactly what they are doing! + +# The script takes a revision number as argument, looks for English files +# modified in that commit and finds the previous revision from the log. +# It then changes the revision comment for any translation that was +# up-to-date with the previous revision. + +[ -d en/ ] || exit 1 + +if [ "$1" ]; then + REV="$1" +else + echo "Usage: unfuzzy-xml <revision>" + exit 1 +fi + +cd en/ +MODIFIED="$(find . -name "*.xml" | xargs grep "^<.*\$Id:.*$REV" | cut -d: -f1)" +cd .. + +for XML in $MODIFIED; do + PREVREV="$(svn log en/$XML | egrep "^r[0-9]{5} \| .* \| [0-9]* lines?" | \ + head -n 2 | tail -n 1 | sed "s/^r\([0-9]*\).*$/\1/")" + echo "$XML: $PREVREV -> $REV" + if [ "$PREVREV"] && [ "$PREVREV" -lt "$REV" ]; then + sed -i "s/^\(.*original version: \)$PREVREV\(.*\)$/\1$REV\2/" */$XML + else + echo "*** Invalid previous revision: '$PREVREV'" + fi +done |