#!/bin/sh
# This script illustrates a possible bug in 'svn merge'

cwd=`pwd`
basename=`basename $0`
scratch_area="`echo $basename | sed -e s/\.sh$//`"
repos=$scratch_area/repos
trunk_url=file:///$cwd/$repos/trunk
branch_url=file:///$cwd/$repos/branch
trunk=$scratch_area/trunk
branch=$scratch_area/branch

rm -rf $scratch_area
mkdir -p $scratch_area

# Create a repository
mkdir -p $trunk
echo alpha > $trunk/alpha
echo beta > $trunk/beta
svnadmin create $cwd/$repos
svn import $trunk $trunk_url -m "importing project tree"
svn copy $trunk_url $branch_url -m "creating branch"
rm -rf $trunk

# Check out working copies
svn checkout $trunk_url $trunk
svn checkout $branch_url $branch

# Copy a file in trunk
svn copy $trunk/alpha $trunk/alpha.copied
svn commit -m "copied alpha" $trunk

# In the branch, move a file different to the copy target path.
svn mv $branch/beta $branch/alpha.copied
# Committing here does not affect the result!

# Merge the copy into the branch
svn merge $trunk_url $branch
# Fails with:
# svn: Working copy path 'alpha.copied' does not exist in repository


