#!/bin/sh

echo "Removing data from previous runs."
rm -rf ext-repos ext-wc
echo "Setting up the scenario (this might take a bit)."
svnadmin create ext-repos
svnadmin load -q ext-repos <<EOF
SVN-fs-dump-format-version: 2

UUID: 0b8647d0-6732-0410-8778-1ddb09981948

Revision-number: 0
Prop-content-length: 56
Content-length: 56

K 8
svn:date
V 27
2007-06-08T16:49:24.224063Z
PROPS-END

Revision-number: 1
Prop-content-length: 122
Content-length: 122

K 7
svn:log
V 19
Initial data import
K 10
svn:author
V 8
cmpilato
K 8
svn:date
V 27
2007-06-08T16:52:02.670852Z
PROPS-END

Node-path: project1
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Node-path: project2
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Node-path: project2/subdir1
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Node-path: project2/subdir1/file.txt
Node-kind: file
Node-action: add
Prop-content-length: 75
Text-content-length: 0
Text-content-md5: d41d8cd98f00b204e9800998ecf8427e
Content-length: 75

K 13
svn:mime-type
V 10
text/plain
K 13
svn:eol-style
V 6
native
PROPS-END


Node-path: project2/subdir2
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Node-path: project2/subdir2/file.txt
Node-kind: file
Node-action: add
Prop-content-length: 75
Text-content-length: 0
Text-content-md5: d41d8cd98f00b204e9800998ecf8427e
Content-length: 75

K 13
svn:mime-type
V 10
text/plain
K 13
svn:eol-style
V 6
native
PROPS-END


Node-path: project3
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Node-path: project3/subdir1
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Node-path: project3/subdir1/file.txt
Node-kind: file
Node-action: add
Prop-content-length: 75
Text-content-length: 0
Text-content-md5: d41d8cd98f00b204e9800998ecf8427e
Content-length: 75

K 13
svn:mime-type
V 10
text/plain
K 13
svn:eol-style
V 6
native
PROPS-END


Node-path: project3/subdir2
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10

PROPS-END


Node-path: project3/subdir2/file.txt
Node-kind: file
Node-action: add
Prop-content-length: 75
Text-content-length: 0
Text-content-md5: d41d8cd98f00b204e9800998ecf8427e
Content-length: 75

K 13
svn:mime-type
V 10
text/plain
K 13
svn:eol-style
V 6
native
PROPS-END


EOF

svn co -q file://`pwd`/ext-repos ext-wc
svn pset -q svn:externals "ext file://`pwd`/ext-repos/project2" ext-wc/project1
svn ci -q -m "Add an externals definition" ext-wc
svn up -q ext-wc
svn pset -q svn:externals "ext file://`pwd`/ext-repos/project3" ext-wc/project1
svn up -q ext-wc
echo "We've got a modified externals definition, but if you see a switched"
echo "working copy in the 'svn status' output below, something ain't working:"
echo ""
svn st ext-wc
