@echo off
rem ##############################################################################
rem ##                                                                          ##
rem ##  This is a template for writing Subversion bug reproduction scripts.     ##
rem ##                                                                          ##
rem ##  It creates a repository containing the standard Greek Tree (see         ##
rem ##  http://svn.collab.net/repos/svn/trunk/subversion/tests/greek-tree.txt)  ##
rem ##  and checks out a working copy containing that tree.  Please adjust      ##
rem ##  this script however you need to to demonstrate your bug.  When it's     ##
rem ##  ready, post the bug report to dev@subversion.apache.org -- after        ##
rem ##  http://subversion.apache.org/docs/community-guide/issues.html#reporting-bugs, ##
rem ##  of course.                                                              ##
rem ##                                                                          ##
rem ##############################################################################

:defineCommands
rem You might need to adjust these lines to point to your
rem compiled-from-source Subversion binaries, if using those:
for %%i in (svn.exe) do set SVN="%%~$PATH:i"
for %%i in (svnadmin.exe) do set SVNADMIN="%%~$PATH:i"

:defineUrls
rem Only supported access method: file://. If http:// or svn://, then
rem you'll have to configure it yourself first.
set URL=file:///%CD%/repos
set URL=%URL:\=/%
echo Base url for repo: %URL%

:cleanAllDirsAndCreateRepo
rmdir /s /q repos wc import-me
%SVNADMIN% create repos

:prepareGreekTree
echo Making a Greek Tree for import...
mkdir import-me
mkdir import-me\trunk
mkdir import-me\tags
mkdir import-me\branches
mkdir import-me\trunk\A
mkdir import-me\trunk\A\B\
mkdir import-me\trunk\A\C\
mkdir import-me\trunk\A\D\
mkdir import-me\trunk\A\B\E\
mkdir import-me\trunk\A\B\F\
mkdir import-me\trunk\A\D\G\
mkdir import-me\trunk\A\D\H\
echo This is the file 'iota'.        > import-me\trunk\iota
echo This is the file 'A\mu'.        > import-me\trunk\A\mu
echo This is the file 'A\B\lambda'.  > import-me\trunk\A\B\lambda
echo This is the file 'A\B\E\alpha'. > import-me\trunk\A\B\E\alpha
echo This is the file 'A\B\E\beta'.  > import-me\trunk\A\B\E\beta
echo This is the file 'A\D\gamma'.   > import-me\trunk\A\D\gamma
echo This is the file 'A\D\G\pi'.    > import-me\trunk\A\D\G\pi
echo This is the file 'A\D\G\rho'.   > import-me\trunk\A\D\G\rho
echo This is the file 'A\D\G\tau'.   > import-me\trunk\A\D\G\tau
echo This is the file 'A\D\H\chi'.   > import-me\trunk\A\D\H\chi
echo This is the file 'A\D\H\omega'. > import-me\trunk\A\D\H\omega
echo This is the file 'A\D\H\psi'.   > import-me\trunk\A\D\H\psi
echo Importing it...
cd import-me
%SVN% import -q -m "Initial import." %URL%
cd ..

:checkoutTrunk
echo Checking out working copy..
%SVN% co -q %URL%/trunk wc
rem This is where your reproduction recipe goes.

:reproduceBug
rem TRUNK: branching, then modifying B\lambda
cd wc
set MY_BRANCH_NAME=developmentOnLambda
%SVN% cp %URL%/trunk %URL%/branches/%MY_BRANCH_NAME% -m "copying the initial structure"
%SVN% move A/B A/C
%SVN% ci -m "Moving A\B inside A\C"
cd ..

rem BRANCH: modifying A/B/lambda, then trying to merge from trunk (where A/B/lambda has been moved)
rmdir /s /q wc_%MY_BRANCH_NAME%
%SVN% co -q %URL%/branches/%MY_BRANCH_NAME% wc_%MY_BRANCH_NAME%
cd wc_%MY_BRANCH_NAME%

echo modified in branch %MY_BRANCH_NAME%, on >> A/B/lambda
date /t >> A\B\lambda
echo ------- modified content of lambda:
type A\B\lambda
echo -------
%SVN% ci -m "developing on B\lambda"

rem BRANCH: merging from trunk
%SVN% merge %URL%/trunk/ .
%SVN% status
echo *** ERROR ***
echo Expected: tree conflict for a\B\lambda: moved in trunk, modified in branch
echo Actual: A\B\lambda gets DELETED without warning
cd ..

goto :eof
