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