gravatar
kpeter (Peter Kovacs)
kpeter@inf.elte.hu
Improve unify-sources.sh (#186) Errors can also be accepted when the script is used as a hg hook. Sometimes it is useful (e.g. if someone else made the errors).
0 1 0
default
1 file changed with 3 insertions and 6 deletions:
↑ Collapse diff ↑
Ignore white space 24 line context
... ...
@@ -121,42 +121,39 @@
121 121

	
122 122
function check_init() {
123 123
    echo Check source files...
124 124
    FAILED_FILES=0
125 125
    WARNED_FILES=0
126 126
    TOTAL_FILES=0
127 127
}
128 128

	
129 129
function check_done() {
130 130
    echo $FAILED_FILES out of $TOTAL_FILES files has been failed.
131 131
    echo $WARNED_FILES out of $TOTAL_FILES files triggered warnings.
132 132

	
133
    if [ $FAILED_FILES -gt 0 ]
134
    then
135
	return 1
136
    elif [ $WARNED_FILES -gt 0 ]
133
    if [ $WARNED_FILES -gt 0 -o $FAILED_FILES -gt 0 ]
137 134
    then
138 135
	if [ "$WARNING" == 'INTERACTIVE' ]
139 136
	then
140
	    echo -n "Are the files with warnings acceptable? (yes/no) "
137
	    echo -n "Are the files with errors/warnings acceptable? (yes/no) "
141 138
	    while read answer
142 139
	    do
143 140
		if [ "$answer" == 'yes' ]
144 141
		then
145 142
		    return 0
146 143
		elif [ "$answer" == 'no' ]
147 144
		then
148 145
		    return 1
149 146
		fi
150
		echo -n "Are the files with warnings acceptable? (yes/no) "
147
		echo -n "Are the files with errors/warnings acceptable? (yes/no) "
151 148
	    done
152 149
	elif [ "$WARNING" == 'WERROR' ]
153 150
	then
154 151
	    return 1
155 152
	fi
156 153
    fi
157 154
}
158 155

	
159 156
function check_begin() {
160 157
    ((TOTAL_FILES++))
161 158
    FAILED=NO
162 159
    WARNED=NO
0 comments (0 inline)