Changeset 331:2f5c0c42a5cd in lemon-1.2
- Timestamp:
- 10/22/08 15:37:43 (16 years ago)
- Branch:
- default
- Parents:
- 325:0fbbb4bc42dd (diff), 329:d900fd1e760f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/unify-sources.sh
r325 r331 89 89 if ! diff -q $1 $2 >/dev/null 90 90 then 91 echo -n " [$3 failed]" 91 echo 92 echo -n " $3 failed at line(s): " 93 echo -n $(diff $1 $2 | grep '^[0-9]' | sed "s/^\(.*\)c.*$/ \1/g" | 94 sed "s/,/-/g" | paste -s -d',') 92 95 FAILED=YES 93 96 fi … … 95 98 96 99 function check_warning() { 97 echo -n " [$2 warning]" 100 echo 101 if [ "$2" == 'long lines' ] 102 then 103 echo -n " $2 warning at line(s): " 104 echo -n $(grep -n -E '.{81,}' $1 | sed "s/^\([0-9]*\)/ \1\t/g" | 105 cut -f 1 | paste -s -d',') 106 else 107 echo -n " $2 warning" 108 fi 98 109 WARNED=YES 99 110 } … … 213 224 cat $1 | sed -e 's/ \+$//g' >$TMP_FILE 214 225 215 "$ACTION"_action "$TMP_FILE" "$1" ' spaces'226 "$ACTION"_action "$TMP_FILE" "$1" 'trailing spaces' 216 227 } 217 228 … … 226 237 227 238 function process_file() { 228 echo -n " $ACTION " $1...239 echo -n " $ACTION $1..." 229 240 230 241 CHECKING="header tabs spaces long_lines" … … 266 277 Make all warnings into errors. 267 278 --all|-a 268 All files in the repository will be checked.279 Check all source files in the repository. 269 280 --modified|-m 270 281 Check only the modified (and new) source files. This option is … … 282 293 Print this help message. 283 294 files 284 The files to check/unify. If no file names are given, the 285 modified source will be checked/unified286 295 The files to check/unify. If no file names are given, the modified 296 source files will be checked/unified (just like using the 297 --modified|-m option). 287 298 " 288 299 exit 0 289 300 elif [ "$1" == '--dry-run' ] || [ "$1" == '-n' ] 290 301 then 291 [ -n "$ACTION" ] && echo " Invalid option $1" >&2 && exit 1302 [ -n "$ACTION" ] && echo "Conflicting action options" >&2 && exit 1 292 303 ACTION=check 293 304 elif [ "$1" == "--all" ] || [ "$1" == '-a' ] 294 305 then 295 [ -n "$FILES" ] && echo " Invalid option $1" >&2 && exit 1306 [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1 296 307 FILES=all_files 297 308 elif [ "$1" == "--changed" ] || [ "$1" == '-c' ] 298 309 then 299 [ -n "$FILES" ] && echo " Invalid option $1" >&2 && exit 1310 [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1 300 311 FILES=changed_files 301 312 elif [ "$1" == "--modified" ] || [ "$1" == '-m' ] 302 313 then 303 [ -n "$FILES" ] && echo " Invalid option $1" >&2 && exit 1314 [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1 304 315 FILES=modified_files 305 316 elif [ "$1" == "--interactive" ] || [ "$1" == "-i" ] 306 317 then 307 [ -n "$WARNING" ] && echo " Invalid option $1" >&2 && exit 1318 [ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1 308 319 WARNING='INTERACTIVE' 309 320 elif [ "$1" == "--werror" ] || [ "$1" == "-w" ] 310 321 then 311 [ -n "$WARNING" ] && echo " Invalid option $1" >&2 && exit 1322 [ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1 312 323 WARNING='WERROR' 313 elif [ $(echo $1 | cut -c 1) == '-' ]324 elif [ $(echo x$1 | cut -c 2) == '-' ] 314 325 then 315 326 echo "Invalid option $1" >&2 && exit 1 -
scripts/unify-sources.sh
r329 r331 66 66 function update_done() { 67 67 echo $CHANGED_FILES out of $TOTAL_FILES files has been changed. 68 echo $WARNED_FILES out of $TOTAL_FILES files has been warned.68 echo $WARNED_FILES out of $TOTAL_FILES files triggered warnings. 69 69 } 70 70 … … 119 119 function check_done() { 120 120 echo $FAILED_FILES out of $TOTAL_FILES files has been failed. 121 echo $WARNED_FILES out of $TOTAL_FILES files has been warned.121 echo $WARNED_FILES out of $TOTAL_FILES files triggered warnings. 122 122 123 123 if [ $FAILED_FILES -gt 0 ] … … 128 128 if [ "$WARNING" == 'INTERACTIVE' ] 129 129 then 130 echo -n "A ssume as normal behaviour? (yes/no) "130 echo -n "Are the files with warnings acceptable? (yes/no) " 131 131 while read answer 132 132 do … … 138 138 return 1 139 139 fi 140 echo -n "A ssume as normal behaviour? (yes/no) "140 echo -n "Are the files with warnings acceptable? (yes/no) " 141 141 done 142 142 elif [ "$WARNING" == 'WERROR' ] … … 269 269 Options: 270 270 --dry-run|-n 271 Check the givenfiles, but do not modify them.271 Check the files, but do not modify them. 272 272 --interactive|-i 273 If --dry-run is specified and files are warned, then a message is 274 prompted whether the warnings should be turned to errors. 273 If --dry-run is specified and the checker emits warnings, 274 then the user is asked if the warnings should be considered 275 errors. 275 276 --werror|-w 276 If --dry-run is specified, the warnings are turnedto errors.277 Make all warnings into errors. 277 278 --all|-a 278 279 Check all source files in the repository. 279 280 --modified|-m 280 Check only the modified source files. This option is proper to 281 use before a commit. E.g. all files which are modified or added 282 into the repository will be updated. 281 Check only the modified (and new) source files. This option is 282 useful to check the modification before making a commit. 283 283 --changed|-c 284 284 Check only the changed source files compared to the parent(s) of 285 the current hg node. This option is proper to use as hg hook 286 script. E.g. to check all your commited source files with this 287 script add the following section to the appropriate .hg/hgrc 288 file. 285 the current hg node. This option is useful as hg hook script. 286 To automatically check all your changes before making a commit, 287 add the following section to the appropriate .hg/hgrc file. 289 288 290 289 [hooks]
Note: See TracChangeset
for help on using the changeset viewer.