blob: 314320a851d2c536c563f8abf23d717b2d74c697 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
|