7 if [ -n "$(hg st $1)" ]; then
10 hg log -l 1 --template='{date|isodate}\n' $1 |
15 function update_header() {
19 (echo "/* -*- mode: C++; indent-tabs-mode: nil; -*-
21 * This file is a part of LEMON, a generic C++ optimization library.
23 * Copyright (C) 2003-"$(hg_year $1)"
24 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
25 * (Egervary Research Group on Combinatorial Optimization, EGRES).
27 * Permission to use, modify and distribute this software is granted
28 * provided that this copyright notice appears in all copies. For
29 * precise terms see the accompanying LICENSE file.
31 * This software is provided \"AS IS\" with no warranty of any kind,
32 * express or implied, and with no claim as to its suitability for any
39 /\/\* / && pm==0 { pm=1;}
40 /[^:blank:]/ && (pm==0 || pm==2) { pm=3; print;}
41 /\*\// && pm==1 { pm=2;}
45 HEADER_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
48 mv $TMP_FILE $FILE_NAME
51 function update_tabs() {
56 sed -e 's/\t/ /g' >$TMP_FILE
58 TABS_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
61 mv $TMP_FILE $FILE_NAME
64 function remove_trailing_space() {
69 sed -e 's/ \+$//g' >$TMP_FILE
71 SPACES_CH=`diff -q $TMP_FILE $FILE_NAME >/dev/null&&echo NO||echo YES`
74 mv $TMP_FILE $FILE_NAME
77 function long_line_test() {
78 cat $1 |grep -q -E '.{81,}'
81 function update_file() {
82 echo -n ' update' $i ...
86 remove_trailing_space $1
89 if [[ $HEADER_CH = YES ]];
91 echo -n ' [header updated]'
94 if [[ $TABS_CH = YES ]];
96 echo -n ' [tabs removed]'
99 if [[ $SPACES_CH = YES ]];
101 echo -n ' [trailing spaces removed]'
104 if long_line_test $1 ;
106 echo -n ' [LONG LINES]'
107 ((LONG_LINE_FILES++))
110 if [[ $CHANGED = YES ]];
120 echo Update all source files...
121 for i in `hg manifest|grep -E '\.(cc|h|dox)$'`
123 update_file $HGROOT/$i
134 echo $CHANGED_FILES out of $TOTAL_FILES files has been changed.
135 if [[ $LONG_LINE_FILES -gt 1 ]]; then
137 echo WARNING: $LONG_LINE_FILES files contains long lines!
139 elif [[ $LONG_LINE_FILES -gt 0 ]]; then
141 echo WARNING: a file contains long lines!