]> git.saurik.com Git - wxWidgets.git/blob - misc/scripts/svn/hooks/pre-commit
5dabb3cea79ce22843599564bfc552774e3e9de3
[wxWidgets.git] / misc / scripts / svn / hooks / pre-commit
1 #!/bin/sh
2
3 REPOS="$1"
4 TXN="$2"
5
6 SVNLOOK=/usr/bin/svnlook
7
8 svn_cat() {
9 $SVNLOOK cat "$REPOS" -t "$TXN" $1
10 }
11
12 all_changed_files=`$SVNLOOK changed "$REPOS" -t "$TXN" | \
13 grep "^[AU]" | \
14 sed 's/^....//'`
15
16 changed_sources=`echo $all_changed_files | \
17 egrep "\.(cpp|h|py)$" | \
18 egrep -v "src/(tiff|regex|jpeg|stc/scintilla)"`
19
20 rc=0
21
22 set -e
23
24 for f in $changed_sources; do
25 if svn_cat $f | fgrep -q ' '; then
26 echo "Please remove TABs from $f before committing." >&2
27 rc=1
28 fi
29 done
30
31 for f in $all_changed_files; do
32 if ! svn_cat $f | iconv -f utf8 -t WCHAR_T > /dev/null; then
33 echo "File $f doesn't use UTF-8, please convert it before committing." >&2
34 rc=1
35 fi
36 done
37
38 exit $rc