~ubuntu-branches/ubuntu/wily/installation-guide/wily

2.1.1 by Frans Pop, Frans Pop, Joey Hess, Wouter Verhelst
[ Frans Pop ]
1
#! /bin/bash
2
3
# This script can be used to update the revision comment in translations
4
# after an update in an English original. Result is that translators won't
5
# need to check changes.
6
# This script is intended only for use by people working on the original
7
# English text and then only if they know exactly what they are doing!
8
9
# The script takes a revision number as argument, looks for English files
10
# modified in that commit and finds the previous revision of the file.
11
# It then changes the revision comment for any translation that was
12
# up-to-date with the previous revision.
13
14
[ -d en/ ] || exit 1
15
16
if [ "$1" ]; then
17
	REV="$1"
18
else
19
	echo "Usage: unfuzzy-xml <revision>"
20
	exit 1
21
fi
22
23
cd en/
24
MODIFIED="$(find . -name "*.xml" | xargs grep "^<.*\$Id:.*$REV" | cut -d: -f1)"
25
cd ..
26
27
for XML in $MODIFIED; do
28
	PREVREV="$(svn cat -r $(($REV - 1)) en/$XML | grep "^<.*\$Id:" | \
29
		   sed "s/^.*\.xml \([0-9]*\) .*/\1/")"
30
	echo "$XML: $PREVREV -> $REV"
31
	if [ "$PREVREV" ] && [ "$PREVREV" -lt "$REV" ]; then
32
		sed -i "s/^\(.*original version: \)$PREVREV\(.*\)$/\1$REV\2/" */$XML
33
	else
34
		echo "*** Invalid previous revision: '$PREVREV'"
35
	fi
36
done