forked from roundcube/roundcubemail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
roundcube_diff.sh
executable file
·65 lines (59 loc) · 2.04 KB
/
roundcube_diff.sh
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/sh
#
# Script to display diffs in Roundcube localisation between releases
#
# CLI parameters can be displayed by parsing `-h`. See the README for more
# informations.
usage () {
echo ""
echo "USAGE: "
echo " $0 -p path/to/git/repo -i 1.3.4 -f 1.3.5 -l en_US -o roundcube_diff.txt"
echo " -h show this help message"
echo " -p path to the roundcube git repository (default: roundcubemail)"
echo " -i initial roundcube release"
echo " -f final roundcube release"
echo " -l locale code (default: en_US)"
echo " -o output file (default: diff.txt)"
echo ""
exit 1
}
repo_path="roundcubemail"
locale="en_US"
output="diff.txt"
# CLI arguments comprehension
while getopts "p:i:f:l:o:h" opt; do
case $opt in
h) usage ;;
p) repo_path=$OPTARG ;;
i) initial=$OPTARG ;;
f) final=$OPTARG ;;
l) locale=$OPTARG ;;
o) output=$OPTARG ;;
*)
usage
;;
esac
done
# Download git repository or update it if it exists
if [ ! -d "$repo_path" ]
then
echo "Cloning RoundCube repository"
git clone https://github.com/roundcube/roundcubemail.git $repo_path > /dev/null 2>&1
else
echo "Pulling latest release"
git -C $repo_path checkout master > /dev/null 2>&1
git -C $repo_path pull --rebase origin master > /dev/null 2>&1
fi
git -C $repo_path checkout $final > /dev/null 2>&1
# Check if there are new localisation files in the new release
echo "Checking if there are new localisation files"
echo "#\n# NEW LOCALIZATION FILES\n#\n" > $output
git -C $repo_path diff --color $initial $final -- .tx/config >> $output
# Show diffs for the localisation files
echo "Generating diffs for the localisation files between $initial and $final"
echo "\n#\n# LOCALISATION FILES DIFF BETWEEN $initial and $final\n#\n" >> $output
cat "$repo_path/.tx/config" | grep file_filter | sed "s/file_filter = //; s/<lang>/$locale/" | while read -r file
do
git -C $repo_path diff --color $initial $final -- $file >> $output
done
git -C $repo_path diff --color $initial $final -- program/localisation/$locale/csv2vcard.inc >> $output