scripts/unify-sources.sh
changeset 783 ef88c0a30f85
parent 655 c706534d4740
     1.1 --- a/scripts/unify-sources.sh	Mon Jan 12 23:11:39 2009 +0100
     1.2 +++ b/scripts/unify-sources.sh	Thu Nov 05 15:48:01 2009 +0100
     1.3 @@ -1,8 +1,31 @@
     1.4  #!/bin/bash
     1.5 +#
     1.6 +# This file is a part of LEMON, a generic C++ optimization library.
     1.7 +#
     1.8 +# Copyright (C) 2003-2009
     1.9 +# Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.10 +# (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.11 +#
    1.12 +# Permission to use, modify and distribute this software is granted
    1.13 +# provided that this copyright notice appears in all copies. For
    1.14 +# precise terms see the accompanying LICENSE file.
    1.15 +#
    1.16 +# This software is provided "AS IS" with no warranty of any kind,
    1.17 +# express or implied, and with no claim as to its suitability for any
    1.18 +# purpose.
    1.19  
    1.20 -YEAR=`date +2003-%Y`
    1.21 +YEAR=`date +%Y`
    1.22  HGROOT=`hg root`
    1.23  
    1.24 +function hg_year() {
    1.25 +    if [ -n "$(hg st $1)" ]; then
    1.26 +        echo $YEAR
    1.27 +    else
    1.28 +        hg log -l 1 --template='{date|isodate}\n' $1 |
    1.29 +        cut -d '-' -f 1
    1.30 +    fi
    1.31 +}
    1.32 +
    1.33  # file enumaration modes
    1.34  
    1.35  function all_files() {
    1.36 @@ -88,7 +111,12 @@
    1.37  function check_action() {
    1.38      if [ "$3" == 'tabs' ]
    1.39      then
    1.40 -        PATTERN=$(echo -e '\t')
    1.41 +        if echo $2 | grep -q -v -E 'Makefile\.am$'
    1.42 +        then
    1.43 +            PATTERN=$(echo -e '\t')
    1.44 +        else
    1.45 +            PATTERN='        '
    1.46 +        fi
    1.47      elif [ "$3" == 'trailing spaces' ]
    1.48      then
    1.49          PATTERN='\ +$'
    1.50 @@ -186,7 +214,7 @@
    1.51   *
    1.52   * This file is a part of LEMON, a generic C++ optimization library.
    1.53   *
    1.54 - * Copyright (C) "$YEAR"
    1.55 + * Copyright (C) 2003-"$(hg_year $1)"
    1.56   * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
    1.57   * (Egervary Research Group on Combinatorial Optimization, EGRES).
    1.58   *