1 | #!/bin/sh |
---|
2 | |
---|
3 | # $Id: repo_status_test.sh 978 2009-12-12 20:09:41Z peter $ |
---|
4 | |
---|
5 | # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson |
---|
6 | # Copyright (C) 2009 Peter Johansson |
---|
7 | # |
---|
8 | # This file is part of svndigest, http://dev.thep.lu.se/svndigest |
---|
9 | # |
---|
10 | # svndigest is free software; you can redistribute it and/or modify it |
---|
11 | # under the terms of the GNU General Public License as published by |
---|
12 | # the Free Software Foundation; either version 3 of the License, or |
---|
13 | # (at your option) any later version. |
---|
14 | # |
---|
15 | # svndigest is distributed in the hope that it will be useful, but |
---|
16 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
18 | # General Public License for more details. |
---|
19 | # |
---|
20 | # You should have received a copy of the GNU General Public License |
---|
21 | # along with svndigest. If not, see <http://www.gnu.org/licenses/>. |
---|
22 | |
---|
23 | required="wc" |
---|
24 | . ./init.sh |
---|
25 | |
---|
26 | set -e |
---|
27 | |
---|
28 | # assume test repository and svndigest repository are synchronized |
---|
29 | repository_status=1 |
---|
30 | |
---|
31 | # retrieve last revision in test repository |
---|
32 | rev=`cat ${repo}/db/current` |
---|
33 | rev=${rev%% *} |
---|
34 | |
---|
35 | # check if the last test revision is a part of the svndigest repository |
---|
36 | status_return=`$SVN status -v ${repo}/db/revs/$rev` |
---|
37 | # logic: (file does not exist) || (file exists but not in revision control) |
---|
38 | if [[ ${#status_return} -eq 0 || ${status_return:0:1} = "?" ]]; then |
---|
39 | repository_status=0 |
---|
40 | echo "ERROR: test repository and svndigest repository are not synchronized:" |
---|
41 | echo "ERROR: test repository has entries not added to svndigest repository" |
---|
42 | echo "ERROR:" |
---|
43 | echo "ERROR: Please resolve issues before committing to svndigest repository" |
---|
44 | echo "ERROR: test revision(s) needs to be added the svndigest repository." |
---|
45 | echo "ERROR:" |
---|
46 | echo "ERROR: Issue these commands:" |
---|
47 | fi |
---|
48 | |
---|
49 | # loop until a test repository revision that is a part of svndigest |
---|
50 | # repository is found, or break the test repository revision 0 is |
---|
51 | # reached. |
---|
52 | while [[ ${#status_return} -eq 0 || ${status_return:0:1} = "?" ]] && [ $rev -ge 0 ]; do |
---|
53 | echo "ERROR: svn add test/repo/db/revs/$rev test/repo/db/revprops/$rev" |
---|
54 | let rev-- |
---|
55 | status_return=`$SVN status -v ${repo}/db/revs/$rev` |
---|
56 | done |
---|
57 | |
---|
58 | if [ $repository_status -eq 0 ]; then |
---|
59 | exit_fail; # test failed. |
---|
60 | fi |
---|
61 | |
---|
62 | exit_success |
---|