#!/bin/sh # File: test-svn2svn.include # # This is an include for all Subvesion to Subversion tests. # Tested with Subversion 1.3.0 STARTDIR=$PWD # Fast exit, if no backend installed which svn >/dev/null 2>&1 || exit 201 # Exit immediately if a command exits with a non-zero set -e # Create a new empty tempdirectory and work there. rm -rf testdir mkdir testdir cd testdir REPOSITORY=$PWD/work-repos subversion_setup() { rm -rf $REPOSITORY svnadmin create $REPOSITORY rm -rf tempdir mkdir tempdir cd tempdir mkdir project #mkdir project/trunk #mkdir project/branches #mkdir project/tags svn import . file://$REPOSITORY --message 'Initial import' cd .. rm -rf tempdir # checkout initial version svn checkout file://$REPOSITORY/project subversion-work cd subversion-work } tailor_svn2svn() { # create first for tailor cat <test-svn2svn.conf [DEFAULT] use-propset = True #verbose = True #Debug = True [project] patch-name-format = "" root-directory = $PWD/rootdir source = svn:source target = svn:target [svn:source] repository = file://$REPOSITORY module = project subdir = svn1side [svn:target] repository = file://$PWD/svnrepository module = project subdir = svn2side EOF # Convert from Subversion to other Subversion tailor -c test-svn2svn.conf } target_diff() { if diff -Naur -x ".svn" subversion-work rootdir/svn2side >test0.log then echo "WD-diff: PASS" else echo "WD-diff: Diffs in Working Dir! (see test0.log)" >&2 exit 100 fi } subversion_logs() { # Create a log to see into: cd rootdir/svn1side LANG=C svn --verbose log >../../test1.log cd ../svn2side LANG=C svn --verbose log >../../test2.log cd ../.. # Makeup for count of lines in title line, # strip out the non converted things, # remove initial import. # "r3 | hn | 2007-06-17 12:49:45 +0200 (Sun, 17 Jun 2007) | 1 line" # "r3 | hn | 2007-06-17 12:49:45 +0200 (Sun, 17 Jun 2007) | 2 lines" sed -r -e 's/^([^\|]*\| ){3}(.*)$/\1n lines/' < test1.log \ | head -n -6 > test1-v.log sed -r -e 's/^([^\|]*\| ){3}(.*)$/\1n lines/' < test2.log \ | grep -v -E "REMOVE-STUBS" \ | head -n -6 > test2-v.log # Compair logs if diff -B test1-v.log test2-v.log >/dev/null then echo "Log-diff: PASS" else echo "Log-diff: Logs are different!" >&2 exit 200 fi } testing_runs() { cd .. tailor_svn2svn target_diff subversion_logs cd $STARTDIR }