1364 |
05 Jun 11 |
peter |
#!/bin/sh |
1364 |
05 Jun 11 |
peter |
2 |
|
1364 |
05 Jun 11 |
peter |
# $Id$ |
1364 |
05 Jun 11 |
peter |
4 |
|
1532 |
05 Oct 12 |
peter |
# Copyright (C) 2011, 2012 Peter Johansson |
1364 |
05 Jun 11 |
peter |
6 |
# |
1364 |
05 Jun 11 |
peter |
# This file is part of svndigest, http://dev.thep.lu.se/svndigest |
1364 |
05 Jun 11 |
peter |
8 |
# |
1364 |
05 Jun 11 |
peter |
# svndigest is free software; you can redistribute it and/or modify it |
1364 |
05 Jun 11 |
peter |
# under the terms of the GNU General Public License as published by |
1364 |
05 Jun 11 |
peter |
# the Free Software Foundation; either version 3 of the License, or |
1364 |
05 Jun 11 |
peter |
# (at your option) any later version. |
1364 |
05 Jun 11 |
peter |
13 |
# |
1364 |
05 Jun 11 |
peter |
# svndigest is distributed in the hope that it will be useful, but |
1364 |
05 Jun 11 |
peter |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
1364 |
05 Jun 11 |
peter |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1364 |
05 Jun 11 |
peter |
# General Public License for more details. |
1364 |
05 Jun 11 |
peter |
18 |
# |
1364 |
05 Jun 11 |
peter |
# You should have received a copy of the GNU General Public License |
1364 |
05 Jun 11 |
peter |
# along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
1364 |
05 Jun 11 |
peter |
21 |
|
1364 |
05 Jun 11 |
peter |
22 |
required="repo" |
1364 |
05 Jun 11 |
peter |
23 |
|
1525 |
01 Oct 12 |
peter |
24 |
. test/init.sh || exit 99 |
1364 |
05 Jun 11 |
peter |
25 |
|
1364 |
05 Jun 11 |
peter |
# exit if cmd fails |
1364 |
05 Jun 11 |
peter |
27 |
set -e |
1364 |
05 Jun 11 |
peter |
28 |
|
1364 |
05 Jun 11 |
peter |
29 |
file=Credits.txt |
1364 |
05 Jun 11 |
peter |
30 |
cache_dir=$rootdir/alhambra/.svndigest |
1364 |
05 Jun 11 |
peter |
31 |
cache_file=$cache_dir/${file}.svncopyright-cache |
1364 |
05 Jun 11 |
peter |
32 |
rm -f $cache_file |
1364 |
05 Jun 11 |
peter |
33 |
|
1364 |
05 Jun 11 |
peter |
# mini config file |
1364 |
05 Jun 11 |
peter |
35 |
cat > config <<EOF |
1364 |
05 Jun 11 |
peter |
36 |
[copyright-alias] |
1364 |
05 Jun 11 |
peter |
37 |
jari = Jari Häkkinen |
1364 |
05 Jun 11 |
peter |
38 |
peter = Peter Johansson |
1364 |
05 Jun 11 |
peter |
39 |
EOF |
1364 |
05 Jun 11 |
peter |
40 |
|
1364 |
05 Jun 11 |
peter |
41 |
$SVN revert -R $rootdir |
1364 |
05 Jun 11 |
peter |
42 |
SVNCOPYRIGHT_run 0 -r $rootdir/alhambra --ignore-cache -v --config-file=config |
1364 |
05 Jun 11 |
peter |
43 |
test -s stderr && exit_fail |
1364 |
05 Jun 11 |
peter |
44 |
test -r $cache_file || exit_fail |
1551 |
03 Nov 12 |
peter |
45 |
cat $cache_file |
1364 |
05 Jun 11 |
peter |
# check that we cache user name not alias |
1364 |
05 Jun 11 |
peter |
47 |
grep peter $cache_file || exit_fail |
1364 |
05 Jun 11 |
peter |
48 |
cp $cache_file cache.txt |
1364 |
05 Jun 11 |
peter |
49 |
|
1364 |
05 Jun 11 |
peter |
50 |
cat > correct.txt <<EOF |
1364 |
05 Jun 11 |
peter |
51 |
Copyright (C) 2006 Jari Häkkinen |
1364 |
05 Jun 11 |
peter |
52 |
Copyright (C) 2009 Peter Johansson |
1364 |
05 Jun 11 |
peter |
53 |
EOF |
1364 |
05 Jun 11 |
peter |
54 |
grep 'Copyright (C)' $rootdir/alhambra/$file > copyright.txt || exit_fail |
1364 |
05 Jun 11 |
peter |
55 |
diff -u correct.txt copyright.txt || exit_fail |
1364 |
05 Jun 11 |
peter |
56 |
|
1364 |
05 Jun 11 |
peter |
# modify the cache file to allow us to detect that it is used |
1381 |
14 Jun 11 |
peter |
58 |
sed 's/peter/winston/' $cache_file > ${cache_file}2 |
1381 |
14 Jun 11 |
peter |
59 |
mv ${cache_file}2 ${cache_file} |
1376 |
14 Jun 11 |
peter |
60 |
cat $cache_file |
1364 |
05 Jun 11 |
peter |
# create a config reflecting this name change |
1364 |
05 Jun 11 |
peter |
62 |
sed 's/peter/winston/' config > config2 |
1364 |
05 Jun 11 |
peter |
63 |
|
1364 |
05 Jun 11 |
peter |
# copyright update using cache created above |
1364 |
05 Jun 11 |
peter |
65 |
$SVN revert -R $rootdir |
1364 |
05 Jun 11 |
peter |
66 |
SVNCOPYRIGHT_run 0 -r $rootdir/alhambra -v --config-file=config2 |
1364 |
05 Jun 11 |
peter |
67 |
test -s stderr && exit_fail |
1364 |
05 Jun 11 |
peter |
68 |
grep 'Copyright (C)' $rootdir/alhambra/$file > copyright2.txt || exit_fail |
1364 |
05 Jun 11 |
peter |
69 |
diff -u correct.txt copyright.txt || exit_fail |
1364 |
05 Jun 11 |
peter |
70 |
|
1364 |
05 Jun 11 |
peter |
71 |
exit_success; |