]>
Commit | Line | Data |
---|---|---|
078a94e0 VZ |
1 | #!/bin/sh |
2 | ||
3 | REPOS="$1" | |
4 | TXN="$2" | |
5 | ||
6 | SVNLOOK=/usr/bin/svnlook | |
7 | ||
3347f618 VZ |
8 | svn_cat() { |
9 | $SVNLOOK cat "$REPOS" -t "$TXN" $1 | |
10 | } | |
11 | ||
12 | all_changed_files=`$SVNLOOK changed "$REPOS" -t "$TXN" | \ | |
078a94e0 | 13 | grep "^[AU]" | \ |
3347f618 VZ |
14 | sed 's/^....//'` |
15 | ||
95e74456 VZ |
16 | # notice that breaking all_changed_files into several lines by replacing spaces |
17 | # with new lines only works as long as we don't have any files with spaces in | |
18 | # them -- which is the case for now, but if it ever changes we'd probably need | |
19 | # to use a shell array for all_changed_files or just rerun svnlook here again | |
3347f618 | 20 | changed_sources=`echo $all_changed_files | \ |
95e74456 | 21 | sed 's/ /\n/g' | \ |
078a94e0 | 22 | egrep "\.(cpp|h|py)$" | \ |
3347f618 | 23 | egrep -v "src/(tiff|regex|jpeg|stc/scintilla)"` |
078a94e0 VZ |
24 | |
25 | rc=0 | |
26 | ||
27 | set -e | |
3347f618 VZ |
28 | |
29 | for f in $changed_sources; do | |
30 | if svn_cat $f | fgrep -q ' '; then | |
078a94e0 VZ |
31 | echo "Please remove TABs from $f before committing." >&2 |
32 | rc=1 | |
33 | fi | |
34 | done | |
35 | ||
3347f618 VZ |
36 | for f in $all_changed_files; do |
37 | if ! svn_cat $f | iconv -f utf8 -t WCHAR_T > /dev/null; then | |
38 | echo "File $f doesn't use UTF-8, please convert it before committing." >&2 | |
39 | rc=1 | |
40 | fi | |
41 | done | |
42 | ||
078a94e0 | 43 | exit $rc |