105 TOTAL_FILES=0 |
105 TOTAL_FILES=0 |
106 } |
106 } |
107 |
107 |
108 function check_done() { |
108 function check_done() { |
109 echo $FAILED_FILES out of $TOTAL_FILES files has been failed. |
109 echo $FAILED_FILES out of $TOTAL_FILES files has been failed. |
110 echo $WARNED_FILES out of $TOTAL_FILES files has been warned. |
110 echo $WARNED_FILES out of $TOTAL_FILES files triggered warnings. |
111 |
111 |
112 if [ $FAILED_FILES -gt 0 ] |
112 if [ $FAILED_FILES -gt 0 ] |
113 then |
113 then |
114 return 1 |
114 return 1 |
115 elif [ $WARNED_FILES -gt 0 ] |
115 elif [ $WARNED_FILES -gt 0 ] |
116 then |
116 then |
117 if [ "$WARNING" == 'INTERACTIVE' ] |
117 if [ "$WARNING" == 'INTERACTIVE' ] |
118 then |
118 then |
119 echo -n "Assume as normal behaviour? (yes/no) " |
119 echo -n "Are the files with warnings acceptable? (yes/no) " |
120 while read answer |
120 while read answer |
121 do |
121 do |
122 if [ "$answer" == 'yes' ] |
122 if [ "$answer" == 'yes' ] |
123 then |
123 then |
124 return 0 |
124 return 0 |
125 elif [ "$answer" == 'no' ] |
125 elif [ "$answer" == 'no' ] |
126 then |
126 then |
127 return 1 |
127 return 1 |
128 fi |
128 fi |
129 echo -n "Assume as normal behaviour? (yes/no) " |
129 echo -n "Are the files with warnings acceptable? (yes/no) " |
130 done |
130 done |
131 elif [ "$WARNING" == 'WERROR' ] |
131 elif [ "$WARNING" == 'WERROR' ] |
132 then |
132 then |
133 return 1 |
133 return 1 |
134 fi |
134 fi |
255 echo -n \ |
255 echo -n \ |
256 "Usage: |
256 "Usage: |
257 $0 [OPTIONS] [files] |
257 $0 [OPTIONS] [files] |
258 Options: |
258 Options: |
259 --dry-run|-n |
259 --dry-run|-n |
260 Check the given files, but do not modify them. |
260 Check the files, but do not modify them. |
261 --interactive|-i |
261 --interactive|-i |
262 If --dry-run is specified and files are warned then a message is |
262 If --dry-run is specified and the checker emits warnings, |
263 prompted whether the warnings should be turned to errors. |
263 then the user is asked if the warnings should be considered |
|
264 errors. |
264 --werror|-w |
265 --werror|-w |
265 If --dry-run is specified and the warnings are turned to errors. |
266 Make all warnings into errors. |
266 --all|-a |
267 --all|-a |
267 All files in the repository will be checked. |
268 All files in the repository will be checked. |
268 --modified|-m |
269 --modified|-m |
269 Check only the modified source files. This option is proper to |
270 Check only the modified (and new) source files. This option is |
270 use before a commit. E.g. all files which are modified or added |
271 useful to check the modification before making a commit. |
271 into the repository will be updated. |
|
272 --changed|-c |
272 --changed|-c |
273 Check only the changed source files compared to the parent(s) of |
273 Check only the changed source files compared to the parent(s) of |
274 the current hg node. This option is proper to use as hg hook |
274 the current hg node. This option is useful as hg hook script. |
275 script. E.g. to check all your commited source files with this |
275 To automatically check all your changes before making a commit, |
276 script add the following section to the appropriate .hg/hgrc |
276 add the following section to the appropriate .hg/hgrc file. |
277 file. |
|
278 |
277 |
279 [hooks] |
278 [hooks] |
280 pretxncommit.checksources = scripts/unify-sources.sh -c -n -i |
279 pretxncommit.checksources = scripts/unify-sources.sh -c -n -i |
281 |
280 |
282 --help|-h |
281 --help|-h |