2 #######################################################################
6 #######################################################################
8 SVNMIRROR
="$PWD/svnmirror.sh"
16 TMPOUT
="$TMPDIR/svnmirror.out"
17 TMPERR
="$TMPDIR/svnmirror.err"
20 LREPOS
="${TMPDIR}/lrepos"
21 RREPOS
="${TMPDIR}/rrepos"
25 PARAMS
="push:none pull:none push:filter pull:filter"
32 $SVNMIRROR > $TMPOUT 2> $TMPERR
35 if [ $RC -gt 0 ]; then
38 if [ "$RC2" != "$RC" ]; then
39 echo "unexpected return code: $RC (expected $EXPRC)"
42 if [ -n "$EXPOUT" ]; then
43 egrep "$EXPOUT" "$TMPOUT" > /dev
/null
2>&1
45 if [ $GRC -gt 0 ]; then
46 echo "expected out not found"
50 if [ -n "$EXPERR" ]; then
51 egrep "$EXPERR" "$TMPERR" > /dev
/null
2>&1
53 if [ $GRC -gt 0 ]; then
54 echo "expected err not found"
58 if [ "$ERR" = "0" ]; then
69 for P
in ${PARAMS}; do
70 MODE
=`echo "$P" | sed 's/:.*$//'`
71 FLTR
=`echo "$P" | sed 's/^.*://'`
73 echo "*** Testing $MODE filter $FLTR ***"
75 if [ "$MODE" = "push" ]; then
87 if [ "$FLTR" = "filter" ]; then
88 FILTER
="include trunk"
90 if [ -d "$LREPOS" ]; then
93 if [ -d "$RREPOS" ]; then
96 if [ -d "$LWC" ]; then
99 if [ -d "$RWC" ]; then
102 svnadmin create
"$RREPOS"
103 svnadmin create
"$LREPOS"
104 svn co
"file://$LREPOS" "$LWC" > /dev
/null
105 svn co
"file://$RREPOS" "$RWC" > /dev
/null
106 export MODE FILTER LREPOS RREPOS RHOST
108 echo "Test 1: both repos empty"
109 mirror_check
0 "both repositories are already at" ""
111 echo "Test 2: add trunk branches and tags."
112 svn mkdir
"$SRCWC/trunk" > /dev
/null
113 svn mkdir
"$SRCWC/branches" > /dev
/null
114 svn mkdir
"$SRCWC/tags" > /dev
/null
115 svn ci
"$SRCWC" -m "add trunk branches and tags." > /dev
/null
116 mirror_check
0 "successfull completed." ""
118 echo "Test 3: filter check."
119 svn
ls "file://$SRCREPOS" > "$TMPOUT"
120 svn
ls "file://$DSTREPOS" > "$TMPERR"
121 if [ "$FLTR" = "none" ]; then
126 N
=`$CMD "$TMPOUT" | diff - "$TMPERR" | wc -l`
127 if [ $N -gt 0 ]; then
129 echo "+++ STDOUT +++"
131 echo "+++ STDERR +++"
138 # should be the last test bacause all following would fail
139 echo "Test 99: commit to destination repos."
140 svn up
"$DSTWC" > /dev
/null
141 echo "wrong repos" > "$DSTWC/trunk/wrong_repos.txt"
142 svn add
"$DSTWC/trunk/wrong_repos.txt" > /dev
/null
143 svn ci
"$DSTWC" -m "commit to wrong repos" > /dev
/null
144 mirror_check
1 "" "revision of .* repos is higher than .* one"