Merge trunk to branch clobers changes in renamed directory.

View: New views
1 Messages — Rating Filter:   Alert me  

Merge trunk to branch clobers changes in renamed directory.

by Jason K Howlett :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have the following issue with SVN 1.6.1. I have two branches of the trunk. In branch 1 I modify a file in some subdirectory of the source tree and commit it. In branch 2 I rename the grandparent directory that contains the file modified on branch b1. Branch b2 get reintegrated to the trunk. The trunk then gets merged into branch b1. The original directory containing the modified file is deleted without a tree conflict occurring and the changes are lost. Is this a known problem, and how do I work around it to be sure branch changes don't get clobbered when updating from the trunk. The Bash script below recreates the stated problem.

Thanks for the help.

#!/bin/bash -v
rm -rf /tmp/svnprob
mkdir -p /tmp/svnprob

svnadmin create /tmp/svnprob/testrepo
mkdir -p /tmp/svnprob/repo/trunk/src/dir1/dir1_1
mkdir -p /tmp/svnprob/repo/trunk/src/dir1/dir1_2
mkdir -p /tmp/svnprob/repo/trunk/src/dir2
mkdir -p /tmp/svnprob/repo/branches
echo "Original line, file1.cpp" >> /tmp/svnprob/repo/trunk/src/dir1/dir1_1/file1.cpp
echo "Original line, file1.cpp" >> /tmp/svnprob/repo/trunk/src/dir1/dir1_1/file1.h
svn import /tmp/svnprob/repo/ file:///tmp/svnprob/testrepo/ -m "Initial import"
rm -rf /tmp/svnprob/repo
svn co file:///tmp/svnprob/testrepo/ /tmp/svnprob/repo
svn cp file:///tmp/svnprob/testrepo/trunk file:///tmp/svnprob/testrepo/branches/b1 -m "Create branch b1"
svn up /tmp/svnprob/repo

echo  "Another line to file.cpp" >> /tmp/svnprob/repo/branches/b1/src/dir1/dir1_1/file1.cpp
echo  "Another line to file.h" >> /tmp/svnprob/repo/branches/b1/src/dir1/dir1_1/file1.h
svn ci -m "Branch change to file1.cpp" /tmp/svnprob/repo/branches/b1

svn cp file:///tmp/svnprob/testrepo/trunk file:///tmp/svnprob/testrepo/branches/b2 -m "Create branch b2"
svn up /tmp/svnprob/repo

cd /tmp/svnprob/repo/branches/b2/src
svn mv dir1 dir1_new
cd /tmp/svnprob/repo/branches/b2
svn ci -m "Rename dir1 to dir1_new"
cd /tmp/svnprob/repo/trunk
svn up
svn merge --reintegrate file:///tmp/svnprob/testrepo/branches/b2 .
svn ci -m "Merged branch b2 into trunk" /tmp/svnprob/repo/trunk

cd /tmp/svnprob/repo/branches/b1
svn merge file:///tmp/svnprob/testrepo/trunk .
echo "SHOULDN'T A TREE CONFLICT OCCUR HERE?"
svn ci -m "Merge trunk to branch b1"

svn diff file:///tmp/svnprob/testrepo/branches/b1/src/dir1/dir1_1/file1.cpp@3  file:///tmp/svnprob/testrepo/branches/b1/src/dir1_new/dir1_1/file1.cpp
echo "Oh no! My changes are lost"