First NIT release and new clean mercurial repository
[nit.git] / tests / store_save.sh
1 #!/bin/bash
2 # This file is part of NIT ( http://www.nitlanguage.org ).
3 #
4 # Copyright 2004-2008 Jean Privat <jean@pryen.org>
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17
18 # This shell script convert .res into .sav
19
20 [ $# = 0 ] && exit 0;
21
22 f=`echo $1 | cut -f1 -d.`
23 shift
24
25 echo -n "=> $f: "
26
27 if [ -r $f.res ]; then
28 # Result
29 if [ -r $f.sav ]; then
30 diff -q $f.res $f.sav > /dev/null;
31 if [ $? == 0 ]; then
32 echo "[ok] $f"
33 else
34 echo "======== [update] $f.sav ========="
35 cp $f.res $f.sav
36 fi
37 else
38 echo "======== [new] $f.sav ========="
39 cp $f.res $f.sav
40 fi
41 else
42 if [ -r $f.sav ]; then
43 echo "[no res] $f"
44 else
45 echo "[not yet] $f"
46 fi
47 fi
48
49 exec $0 "$@"