COIN-OR::LEMON - Graph Library

Changeset 343:2f5c0c42a5cd in lemon for scripts


Ignore:
Timestamp:
10/22/08 15:37:43 (11 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Parents:
337:0fbbb4bc42dd (diff), 341: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
Message:

Merge

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scripts/unify-sources.sh

    r337 r343  
    8989    if ! diff -q $1 $2 >/dev/null
    9090    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',')
    9295        FAILED=YES
    9396    fi
     
    9598
    9699function 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
    98109    WARNED=YES
    99110}
     
    213224    cat $1 | sed -e 's/ \+$//g' >$TMP_FILE
    214225
    215     "$ACTION"_action "$TMP_FILE" "$1" 'spaces'
     226    "$ACTION"_action "$TMP_FILE" "$1" 'trailing spaces'
    216227}
    217228
     
    226237
    227238function process_file() {
    228     echo -n "    $ACTION " $1...
     239    echo -n "    $ACTION $1..."
    229240
    230241    CHECKING="header tabs spaces long_lines"
     
    266277     Make all warnings into errors.
    267278  --all|-a
    268      All files in the repository will be checked.
     279     Check all source files in the repository.
    269280  --modified|-m
    270281     Check only the modified (and new) source files. This option is
     
    282293     Print this help message.
    283294  files
    284      The files to check/unify. If no file names are given, the
    285      modified source will be checked/unified
    286 
     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).
    287298"
    288299        exit 0
    289300    elif [ "$1" == '--dry-run' ] || [ "$1" == '-n' ]
    290301    then
    291         [ -n "$ACTION" ] && echo "Invalid option $1" >&2 && exit 1
     302        [ -n "$ACTION" ] && echo "Conflicting action options" >&2 && exit 1
    292303        ACTION=check
    293304    elif [ "$1" == "--all" ] || [ "$1" == '-a' ]
    294305    then
    295         [ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
     306        [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    296307        FILES=all_files
    297308    elif [ "$1" == "--changed" ] || [ "$1" == '-c' ]
    298309    then
    299         [ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
     310        [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    300311        FILES=changed_files
    301312    elif [ "$1" == "--modified" ] || [ "$1" == '-m' ]
    302313    then
    303         [ -n "$FILES" ] && echo "Invalid option $1" >&2 && exit 1
     314        [ -n "$FILES" ] && echo "Conflicting target options" >&2 && exit 1
    304315        FILES=modified_files
    305316    elif [ "$1" == "--interactive" ] || [ "$1" == "-i" ]
    306317    then
    307         [ -n "$WARNING" ] && echo "Invalid option $1" >&2 && exit 1
     318        [ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1
    308319        WARNING='INTERACTIVE'
    309320    elif [ "$1" == "--werror" ] || [ "$1" == "-w" ]
    310321    then
    311         [ -n "$WARNING" ] && echo "Invalid option $1" >&2 && exit 1
     322        [ -n "$WARNING" ] && echo "Conflicting warning options" >&2 && exit 1
    312323        WARNING='WERROR'
    313     elif [ $(echo $1 | cut -c 1) == '-' ]
     324    elif [ $(echo x$1 | cut -c 2) == '-' ]
    314325    then
    315326        echo "Invalid option $1" >&2 && exit 1
  • scripts/unify-sources.sh

    r341 r343  
    6666function update_done() {
    6767    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.
    6969}
    7070
     
    119119function check_done() {
    120120    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.
    122122
    123123    if [ $FAILED_FILES -gt 0 ]
     
    128128        if [ "$WARNING" == 'INTERACTIVE' ]
    129129        then
    130             echo -n "Assume as normal behaviour? (yes/no) "
     130            echo -n "Are the files with warnings acceptable? (yes/no) "
    131131            while read answer
    132132            do
     
    138138                    return 1
    139139                fi
    140                 echo -n "Assume as normal behaviour? (yes/no) "             
     140                echo -n "Are the files with warnings acceptable? (yes/no) "
    141141            done
    142142        elif [ "$WARNING" == 'WERROR' ]
     
    269269Options:
    270270  --dry-run|-n
    271      Check the given files, but do not modify them.
     271     Check the files, but do not modify them.
    272272  --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.
    275276  --werror|-w
    276      If --dry-run is specified, the warnings are turned to errors.
     277     Make all warnings into errors.
    277278  --all|-a
    278279     Check all source files in the repository.
    279280  --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.
    283283  --changed|-c
    284284     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.
    289288
    290289       [hooks]
Note: See TracChangeset for help on using the changeset viewer.