summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorFrans Pop <elendil@planet.nl>2006-08-07 16:44:33 +0000
committerFrans Pop <elendil@planet.nl>2006-08-07 16:44:33 +0000
commit430e0614cbcb30ba41a2dc71085e0415d19c27dd (patch)
tree26e2e1394d10baabe39708493841267ab185522b /scripts
parentbb2c571d507d4577b0985e863283d0e96d40464b (diff)
downloadinstallation-guide-430e0614cbcb30ba41a2dc71085e0415d19c27dd.zip
New script to help unfuzzy XML-based translations
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/unfuzzy-xml36
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