⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 svnmirror-test.sh

📁 subversion-1.4.3-1.tar.gz 配置svn的源码
💻 SH
字号:
#!/bin/sh######################################################################### svnmirror-test.sh########################################################################SVNMIRROR="$PWD/svnmirror.sh"if [ ! -d tmp ]; then	mkdir tmpficd tmpTMPDIR="$PWD"TMPOUT="$TMPDIR/svnmirror.out"TMPERR="$TMPDIR/svnmirror.err"RHOST="localhost"LREPOS="${TMPDIR}/lrepos"RREPOS="${TMPDIR}/rrepos"LWC="${TMPDIR}/lwc"RWC="${TMPDIR}/rwc"PARAMS="push:none pull:none push:filter pull:filter"mirror_check() {	EXPRC="$1"	EXPOUT="$2"	EXPERR="$3"	ERR=0	$SVNMIRROR > $TMPOUT 2> $TMPERR	RC="$?"	RC2=0	if [ $RC -gt 0 ]; then		RC2=1	fi	if [ "$RC2" != "$RC" ]; then		echo "unexpected return code: $RC (expected $EXPRC)"		ERR=1	fi	if [ -n "$EXPOUT" ]; then		egrep "$EXPOUT" "$TMPOUT" > /dev/null 2>&1		GRC="$?"		if [ $GRC -gt 0 ]; then			echo "expected out not found"			ERR=1		fi	fi	if [ -n "$EXPERR" ]; then		egrep "$EXPERR" "$TMPERR" > /dev/null 2>&1		GRC="$?"		if [ $GRC -gt 0 ]; then			echo "expected err not found"			ERR=1		fi	fi	if [ "$ERR" = "0" ]; then		echo "OK."	else		echo "+++ STDOUT +++"		cat "$TMPOUT"		echo "+++ STDERR +++"		cat "$TMPERR"		echo "+++ END +++"	fi}for P in ${PARAMS}; do	MODE=`echo "$P" | sed 's/:.*$//'`	FLTR=`echo "$P" | sed 's/^.*://'`	echo ""	echo "*** Testing $MODE filter $FLTR ***"	echo ""	if [ "$MODE" = "push" ]; then		SRCREPOS="$LREPOS"		DSTREPOS="$RREPOS"		SRCWC="$LWC"		DSTWC="$RWC"	else		SRCREPOS="$RREPOS"		DSTREPOS="$LREPOS"		SRCWC="$RWC"		DSTWC="$LWC"	fi	FILTER=""	if [ "$FLTR" = "filter" ]; then		FILTER="include trunk"	fi	if [ -d "$LREPOS" ]; then		rm -rf "$LREPOS"	fi	if [ -d "$RREPOS" ]; then		rm -rf "$RREPOS"	fi	if [ -d "$LWC" ]; then		rm -rf "$LWC"	fi	if [ -d "$RWC" ]; then		rm -rf "$RWC"	fi	svnadmin create "$RREPOS"	svnadmin create "$LREPOS"	svn co "file://$LREPOS" "$LWC" > /dev/null	svn co "file://$RREPOS" "$RWC" > /dev/null	export MODE FILTER LREPOS RREPOS RHOST	echo "Test 1: both repos empty"	mirror_check 0 "both repositories are already at" ""	echo "Test 2: add trunk branches and tags."	svn mkdir "$SRCWC/trunk" > /dev/null	svn mkdir "$SRCWC/branches" > /dev/null	svn mkdir "$SRCWC/tags" > /dev/null	svn ci "$SRCWC" -m "add trunk branches and tags." > /dev/null	mirror_check 0 "successfull completed." ""	echo "Test 3: filter check."	svn ls "file://$SRCREPOS" > "$TMPOUT"	svn ls "file://$DSTREPOS" > "$TMPERR"	if [ "$FLTR" = "none" ]; then		CMD="cat"	else		CMD="egrep ^trunk/"	fi	N=`$CMD "$TMPOUT" | diff - "$TMPERR" | wc -l`	if [ $N -gt 0 ]; then		echo "error."		echo "+++ STDOUT +++"		cat "$TMPOUT"		echo "+++ STDERR +++"		cat "$TMPERR"		echo "+++ END +++"	else		echo "OK."	fi	# should be the last test bacause all following would fail	echo "Test 99: commit to destination repos."	svn up "$DSTWC" > /dev/null	echo "wrong repos" > "$DSTWC/trunk/wrong_repos.txt"	svn add "$DSTWC/trunk/wrong_repos.txt" > /dev/null	svn ci "$DSTWC" -m "commit to wrong repos" > /dev/null	mirror_check 1 "" "revision of .* repos is higher than .* one"done

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -